Where should I place sw.js file in custom serviceWorker workbox injectManifest
jetro4u opened this issue · comments
Jetro Olowole commented
I have conflicting idea on which directory to place the sw.js file.
According to the documentation here https://vite-plugin-pwa.netlify.app/guide/inject-manifest.html#custom-service-worker under Runtime, custom service worker is supposed to be placed in public/sw.js
But in the documentation under workbox the setting below placed it in the src folder
VitePWA({
strategies: 'injectManifest',
srcDir: 'src',
filename: 'sw.ts'
})
When I placed it outside of the public folder I used to get the error that it can't be compiled