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
fix(nuxt): experimental build manifest + client route rules #21641
Conversation
β Live Preview ready!
|
Some things that I would like to see in the manifest :
|
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.
Nice work π―
let timeout: NodeJS.Timeout | ||
const config = useRuntimeConfig() | ||
|
||
async function getLatestManifest () { |
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.
might be worth exposing this or allow customising timeout?
id: buildId, | ||
timestamp: buildTimestamp, | ||
matcher: exportMatcher(routeRulesMatcher), | ||
prerendered: nuxt.options.dev ? [] : [...prerenderedRoutes] |
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.
push /**
as a default route rule when prerendering site
} | ||
}) | ||
if (navigator.connection?.effectiveType !== 'slow-2g') { | ||
setTimeout(getAppManifest, 1000) |
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.
Is this 1s arbitrary?
If so, there is a specific threshold you need to exceed for the script not to be considered blocking (different for devices), if this isn't passing that, maybe it's worth just loading immediately on Nuxt ready?
Looking good π Seems quite powerful, I like the hook for end users to implement how they like. Is it worth solving the tree-shaking route rules for the server/client before merging this to minimise the manifest payload size? |
/trigger release |
π Release triggered! You can now install nuxt@npm:nuxt3@pr-21641 |
Merging to test on next patch. Please do follow up on comments - I think they still need to be addressed. |
I am excited that you completed this feature! |
@lwpinion Could you open an issue with a reproduction? π |
I hope to soon! It's just a matter of trying to find the time. I'm in the middle of a big project. |
π Linked issue
resolves #21370
closes #18419
resolves #15024
related: #14507
resolves #19228
resolves #22720
β Type of change
π Description
This adds an app manifest (accessible at
/_nuxt/builds/meta.json
) and uses it to determine whether to load a payload. We might allow this to be toggleable as an experimental feature.TODO:
π Checklist