You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to inject environment variables in service-worker.js
process.env.VUE_APP_MY_VAR should be replaced by the DefinePlugin of webpack (automatically configured by Vue CLI) by a value defined in my .env but it works for all files except the "service-worker.js"
This last solution uses webpack to bundle the service-worker.js file. In my opinion this should be the default behavior of Vue PWA.
The text was updated successfully, but these errors were encountered:
esynaps
changed the title
[Vue PWA] Inject environment variables in service-worker.js
[Vue PWA] Feature - Inject environment variables in service-worker.js
Jan 7, 2020
This would be a great feature. I'm having the same issue and need to change the service worker to cache different API requests depending on deployed environment e.g. QA, UAT and Prod.
What problem does this feature solve?
We need to inject environment variables in service-worker.js
process.env.VUE_APP_MY_VAR should be replaced by the DefinePlugin of webpack (automatically configured by Vue CLI) by a value defined in my .env but it works for all files except the "service-worker.js"
My vue.config.js
What does the proposed API look like?
I found two obscure solutions for this problem :
The first one : https://stackoverflow.com/a/57051150/4864628
The second (better): https://github.com/diachedelic/vue-cli-plugin-bundle-service-worker
This last solution uses webpack to bundle the service-worker.js file. In my opinion this should be the default behavior of Vue PWA.
The text was updated successfully, but these errors were encountered: