This is the issue I'm getting
- Deploy files to to server
- Service Worker caches all the files
- Deploy updated files to server
- Get this error on refresh after deploying updated files:
Refused to execute script from 'https:/www.example.com/app.jf813asdfd3t.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Doing a hard refresh (CMD + SHIFT + R) skips the service worker cache and loads the newly deployed files without any issues. And then doing a regular refresh causes the error to come back.
My sw.js is not being cached and have nginx setup.
Deploying an update and refreshing pulls files from service worker, but they have the incorrect content-type.

Doing a hard refresh solves the issue

As you can see form the images, the files are being pulled from the same location, except that the service worker is pulling the incorrect content. When I go into the Chrome Develop Tool network tab and "preview" the content the service worker JS file contains only HTML and the hard reloaded one is actual JS.
I am using React with React Router.
This is my sw-precache webpack config:
new SWPrecacheWebpackPlugin({
cacheId: 'someSecretString',
filename: 'sw.js',
dontCacheBustUrlsMatching: [/./],
staticFileGlobs: [path.join(__dirname, '../../build/') + '/**/*.{js,html,css,svg}'],
stripPrefix: path.join(__dirname, '../../build/'),
maximumFileSizeToCacheInBytes: 4194304,
navigateFallback: 'index.html',
})
My initial guess is that it's an issue with nginx, but asking if you guys have any other guesses.
This is the issue I'm getting
Refused to execute script from 'https:/www.example.com/app.jf813asdfd3t.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.Doing a hard refresh (CMD + SHIFT + R) skips the service worker cache and loads the newly deployed files without any issues. And then doing a regular refresh causes the error to come back.
My sw.js is not being cached and have nginx setup.
Deploying an update and refreshing pulls files from service worker, but they have the incorrect content-type.

Doing a hard refresh solves the issue

As you can see form the images, the files are being pulled from the same location, except that the service worker is pulling the incorrect content. When I go into the Chrome Develop Tool network tab and "preview" the content the service worker JS file contains only HTML and the hard reloaded one is actual JS.
I am using React with React Router.
This is my sw-precache webpack config:
My initial guess is that it's an issue with nginx, but asking if you guys have any other guesses.