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): reload nitro when spa loading template updates #24036
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@pi0 do you think there's a way we can programmatically trigger a nitro rebuild to achieve HMR-like effect of updating spa loading template? |
packages/schema/src/config/common.ts
Outdated
spaLoadingTemplate = 'app/spa-loading-template.html' | ||
} | ||
return [ | ||
relative(await get('rootDir'), resolve(await get('srcDir'), spaLoadingTemplate)) |
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.
For future maintainability, I would create an array watchFiles
and push to it (instead of directly contact edge case + filter
AFAIK rollup has no nice API for this and we really re-initialize rollup's watcher instance internally https://github.com/unjs/nitro/blob/main/src/build.ts#L528 |
If you're happy with us calling that nitro hook, we could instead just do that when we detect a change to the file. wdyt? |
Sure you can use |
π Linked issue
β Type of change
π Description
This registers the spa loading template as a path to restart nuxt for.
(I'll update this PR shortly to use watch hook so it doesn't need to restart, but opening it anyway to track.)π Checklist