I鈥檓 trying to use blitz.js with this plugin, but it does not totally add itself to the actual app. Blitz.js uses Next.js, so I was expecting this to work.
On the pages it is supposed to, this tries to add sw.js, but it is not available at /sw.js (404)
Would this be something you鈥檇 be interested in adding support for?
A discovery that I made was that it added the sw.js well in development, but when building the app it does not.
Thank you
@nilaeus Would you mind create a minimal reproduce repository? I will see what I can do.
@shadowwalker https://github.com/nilaeus/blitz-next-pwa
I鈥檝e added some instructions on README on how to get it set up, and the problem.
To solve the problem, change the following line:
https://github.com/nilaeus/blitz-next-pwa/blob/dc54eeb11500af71717c886884f47eb19bf14669/blitz.config.js#L27
dest: "public",
to this:
dest: "../../../public",
The reason is that blitz.js changes the default build folder and the generated sw.js file end up to this location
D:\Workspaces\tmp\blitz-next-pwa\.blitz\caches\build\public\sw.js
However, the static assets are served in the public folder in the project folder, so we need to force the generation to
D:\Workspaces\tmp\blitz-next-pwa\public\sw.js
That works. Thanks for the quick response!
If I change dest to ../../../public, webpack hits me with a
Error: clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.
To verify I went into node_modules to turn on this dangerous setting and indeed it works.
Any suggestions? I suppose setting this dangerous setting to true by default is slightly concerning. Maybe allow passing this in as an option to next-pwa? Maybe someone creates a fork called blitz-pwa? 馃槃
Most helpful comment
If I change
destto../../../public, webpack hits me with aTo verify I went into
node_modulesto turn on this dangerous setting and indeed it works.Any suggestions? I suppose setting this dangerous setting to
trueby default is slightly concerning. Maybe allow passing this in as an option tonext-pwa? Maybe someone creates a fork calledblitz-pwa? 馃槃