I have nested routes in my react app, like https://my-app.com/someroute/new and on https://my-app.com/someroute level service worker registration works fine, but on https://my-app.com/someroute/new level it fails with
Error during service worker registration: DOMException: Failed to register a ServiceWorker for scope ('https://my-app.com/someroute/') with script ('https://my-app.com/someroute/service-worker.js'): The script has an unsupported MIME type ('text/html').
I've tried to set directoryIndex equal to '../' but also no success.
My workbox-plugin config is here:
new GenerateSW({
cacheId: 'my-app',
skipWaiting: true,
clientsClaim: true,
exclude: [/\.map$/, /^manifest.*\.js(?:on)?$/, /\.html$/],
}),