0

I'm trying to implement a service worker for my website. I used SWPrecacheWebpackPlugin with vue and registering and so on works well. Somehow it doesn't cache all files, in this case I guess the most important app.js file.

When I'm online the file structure built by vue looks like the following:

enter image description here

But when I check the cache the app.js file is missing and in offline mode i just get a white page.

enter image description here

So obivously the service-worker is up and running and is even caching some stuff, but not the relevant app.js file.

My webpack config looks like the following:

new SWPrecacheWebpackPlugin({
      cacheId: 'xxx',
      filename: 'service-worker.js',
      staticFileGlobs: ['dist/**/*.{js,html,css}'],
      minify: true,
      stripPrefix: 'dist/'
    })

I have actually no idea what I am missing.

Update:

The app.js file was too big and wasn't cached by the PlugIn. No warning, no error, nothing...

movsky
  • 641
  • 5
  • 22
  • When you run the build process, it generates a manifest file in dist for the SW. Inspect the contents of that file — is your app.js listed there? – pate Oct 06 '19 at 08:23
  • No, it wasn't. But I found the solution. The plugin doesn't cache files that are too big. No warning, nothing, it just doesn't cache. – movsky Oct 06 '19 at 08:47

0 Answers0