Questions tagged [workbox-webpack-plugin]
140 questions
22
votes
3 answers
How can I customize my Service Worker based on environment variables?
Edit: This looks like a duplicate of this Unresolved Question.
Do I mark this as answered, or delete?
I am using InjectManifest from workbox-webpack-plugin inside a Vue CLI 3 app. The custom service worker that I am injecting into has handling for…

Madbarron
- 335
- 1
- 2
- 9
18
votes
1 answer
Checking for service worker updates in a single page app
We have a signal page application that has Service worker installed and active.
Now our server rebuilds the app, Service worker file is being updated on the server side.
Our client has no idea about this new Service worker file and it is still…

Sandeep Sharma
- 1,855
- 3
- 19
- 34
12
votes
1 answer
Apollo offline first support: Service Worker or Persisted Cache?
I have a react app that use apollo as a grapql client.
The app now need offline support for a subset/subapp.
There is a service worker (thanks to workbox and webpack) that do the pre-caching of the assets of the app and works good.
Now there is a…

matiasfha
- 1,270
- 4
- 23
- 42
11
votes
1 answer
How to use Laravel Mix and WorkBox?
I'm trying to build a PWA for my app; and have spent almost 48 hours trying to figure out how to make use of Workbox with Laravel Mix. What's ironical is that Google says Workbox is meant to make things easy!
Buh!
Okay, so far I've figured out that…

TheBigK
- 451
- 5
- 17
10
votes
1 answer
Read env variable from service worker file using workbox
I'm working with workbox-sw and workbox-webpack-plugin
My src sw.js file at root folder (same level with my .env file)
How can I get env variables and accessing it into my src sw.js file
This is from my webpack.config.js
new workboxPlugin({
…

M.Tae
- 1,437
- 1
- 14
- 24
9
votes
3 answers
Webpack workbox Can't find self.__WB_MANIFEST in your SW source
I migrate from v4 to v5 of webpack-workbox-plugin but when I try to build, I got error:
ERROR in Can't find self.__WB_MANIFEST in your SW source.
Child InjectManifest:
Asset Size Chunks Chunk Names
sw.js 1.5 KiB 0 …

SayJeyHi
- 1,559
- 4
- 19
- 39
9
votes
0 answers
Workbox conflicting cache entries when running locally in development
When using the Workbox Webpack Plugin in development mode (locally), I get the following service worker error:
PrecacheController.mjs:62 Uncaught add-to-cache-list-conflicting-entries: Two of the entries passed to…

shennan
- 10,798
- 5
- 44
- 79
8
votes
4 answers
How can I use importScripts() in a Service Worker when using Webpack?
In a Service Worker, I'm trying to import another helper script using importScripts, however I keep getting a Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:5000/src/js/utility.js'…

Diatosta
- 111
- 1
- 1
- 5
7
votes
2 answers
PWA: No matching service worker detected. You may need to reload the page
I get this warning:
No matching service worker detected. You may need to reload the page,
or check that the service worker for the current page also controls
the start of the URL from the manifest.
The thing that my service worker is…

Philipp Mochine
- 4,351
- 10
- 36
- 68
7
votes
0 answers
workbox on https://localhost: fails to fetch random assets
I've got an express server with a self-signed SSL which just serves assets for SPA frontend. When i visit https://localhost:8433 application stats up and successfully fetches all requried assets. However at the same time app's service worker…

ZenDD
- 906
- 1
- 7
- 16
6
votes
1 answer
How to get workboxPlugin.InjectManifest to work with Webpack?
I followed the steps at https://developers.google.com/web/tools/workbox/guides/using-bundlers but the dist/sw.js file after being built was not processed by Webpack at all. All the import statements are still there left untouched, comments are not…

Henry
- 32,689
- 19
- 120
- 221
6
votes
1 answer
workbox webpack plugin exclude folder from precache manifest
I'm using the workbox webpack plugin with vue cli 3 and I would like to exclude the files in a folder from being added to the precache manifest.
See my current file structure below
/src
/assets
/css
/shell
file1.svg
…

Mido eXa
- 71
- 1
- 6
6
votes
1 answer
registerNavigationRoute: precached index.html is not updated NetworkFirst
Context
I have a SPA that use webpack, vueJS and Workbox. In the service-worker, I have the following lines ():
workbox.precaching.precache([
'/index.html'
])
workbox.routing.registerNavigationRoute('/index.html', {
blacklist: [
/.*\.css/,
…

Victor Castro
- 1,232
- 21
- 40
5
votes
0 answers
No matching service worker detected when using GenerateSW from webpack-workbox-plugin
I include
new GenerateSW({
maximumFileSizeToCacheInBytes: 6000000
}),
in the plugins of my webpack config but receive this warning when running lighthouse on my website.
Web app manifest or service worker do not meet the…

Sam
- 1,765
- 11
- 82
- 176
5
votes
1 answer
How to you modify the precache manifest file generated by Workbox? Need urls to have preceding '/'
In the generated precache-manifest.*.js file the URLs all reference relative paths when I need absolute since my app will have some sub-directories as well.
Example of generated file:
self.__precacheManifest = (self.__precacheManifest ||…

shparkison
- 943
- 1
- 8
- 20