Skip to content

Migrate our service worker implementation to workbox #3272

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

Closed
julienw opened this issue Apr 12, 2021 · 0 comments · Fixed by #4151
Closed

Migrate our service worker implementation to workbox #3272

julienw opened this issue Apr 12, 2021 · 0 comments · Fixed by #4151
Labels
code maintenance Issues that are not user facing, but are related the technical debt with the code itself

Comments

@julienw
Copy link
Contributor

julienw commented Apr 12, 2021

Currently we use offline-plugin, but it's not updated for 2 years, it looks unmaintained, and from our work in #3124 we discovered it doesn't support Webpack v5: fails with:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:120:11)
    at Object.resolve (path.js:980:7)
    at afterResolveFn (/home/circleci/project/node_modules/offline-plugin/lib/index.js:213:42)

Therefore we should migrate to workbox.

Workbox has some webpack plugin to find all files handled by webpack. I'm not sure this is strictly needed, but maybe it is.

We need to keep this behavior:

  • cache the main html file, as well as all js css and image files
  • /docs/* and /photon/* shouldn't be cached and should be returned unchanged
  • all requests to other paths should return the same response as for /
  • _headers and _redirects are netlify-specific and need to be excluded as well

We also need to rework the behavior as used by ServiceWorkerManager.js. It's pretty well self-contained, so this should be doable.

@julienw julienw added the code maintenance Issues that are not user facing, but are related the technical debt with the code itself label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code maintenance Issues that are not user facing, but are related the technical debt with the code itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant