-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(service-worker) migrate to service-worker-webpack #391
base: master
Are you sure you want to change the base?
chore(service-worker) migrate to service-worker-webpack #391
Conversation
Nice, thank you! Have you checked if it's working? |
I have a service worker file I want to register
You just remove it, how should it be handled as service worker? |
If you take a look at the new dependency, you’ll see that it generates the service worker using workbox, rather than registering a custom service worker that you author. |
But I have a custom service worker and need it to work with webpack v5 |
Do you need a custom service worker? The last time I looked the generated service worker covered your use cases. Tell me more about the webpack 5 concern? |
I want to migrate to rspack, it can be faster, and it supports only webpack 5. if (url.endsWith('/') || /\^\/fs/.test(pathname))
return;
if (!isGet(request))
return;
if (!isBasic(request))
return;
if (pathname.startsWith('/api'))
return;
if (/^socket.io/.test(pathname))
return; |
You can do excludes like this by configuring workbox. This is referenced in service-worker-webpack's documentation. An example can also be seen here. Alternatively, you can use https://www.npmjs.com/package/next-service-worker which wraps service-worker-webpack with excludes for nextjs. Unfortunately I don't have bandwidth to assist with this further, so feel free to close this PR if you'd like to pursue another option. |
Following up on tatethurston/service-worker-webpack#1
npm run codestyle
is OKnpm test
is OK