-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: add SSR workbox support #66
base: main
Are you sure you want to change the base?
Conversation
? eval(`() => ({ | ||
urlPattern: ({ url, sameOrigin }) => sameOrigin && url.pathname.match(${regex}), | ||
handler: 'NetworkFirst', | ||
options: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add purge on quota error
}, | ||
plugins: [{ | ||
handlerDidError: async () => Response.redirect(${JSON.stringify(offlinePage)}, 302), | ||
cacheWillUpdate: async ({ response }) => response.status === 200 ? response : null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent error here (response can be null/undefined when offline)?
cacheWillUpdate: async ({ response }) => response?.status === 200 ? response : null
&& options.strategies !== 'injectManifest' | ||
|
||
const ssrPages: NuxtPage[] = [] | ||
let nitroOptions: NitroOptions | undefined | ||
nuxt.hook('nitro:init', (nitro) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can just remove the configuration here and configure the options in vite:extendConfig
hook
This PR is too complex to be solved automatically, the runtime caching should be included by the user, there are a lot of configuration that can be included, for example:
|
This PR includes support for SSR Pages via custom runtime caching plugins using NetworkOnly or NetworkFirst handler:
denylist
entry with exact match, if includes dynamic route the plugin will include a wildcard regex insteadTo run the playground, from root:
nr dev:preview:build
.We need to:
somepath-[someparam]
routeRules
: vitesse-nuxt3 is usingprerender
and Elk is usingrouteRules
insteadprerender
(traverse all pages applying therouteRules
match to include/exclude them, maybe creating and using a radix3 router?)The PR using
eval
to generate the runtimeCaching entry per route since we need to provide a few parameters, maybe we can use another approach.