-
-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
Hello,
I'm using https://serwist.pages.dev/ for service worker where I have a code like this:
const firebaseApp = initializeApp({
apiKey: env.NEXT_PUBLIC_FIREBASE_API_KEY,
authDomain: env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
projectId: env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
storageBucket: env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
messagingSenderId: env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
appId: env.NEXT_PUBLIC_FIREBASE_APP_ID,
});
The problem is that it seems like bundling a service worker is a really specific case and somehow when I use env.
instead of process.env
the browser is claiming invalid variables for those that are used in server side. What I think is happening is service worker when importing env tries to access server side variables which are not available during build time (skipValidation: true
on build).
Is there any way to fix this or should I simply not import env in service worker?
Metadata
Metadata
Assignees
Labels
No labels