-
Notifications
You must be signed in to change notification settings - Fork 65
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
Force close process after build
/ prepare
commands
#193
Comments
Start a new pull request in StackBlitz Codeflow. |
cc: @pi0 |
Thanks for the workaround. It works well except that hooks: {
close: (nuxt) => {
if (!nuxt.options._prepare) {
process.exit()
}
},
}, |
~> #185 |
@danielroe I'm not sure if they are indeed the same issues, for me |
I'll leave it open for now then, pending further triage 👌 |
@danielroe This issue still exists on Nuxt 3.7.3 and has nothing to do with |
Yes, the root issue in the linked issue is not actually related to the prepare command |
build
/ prepare
commands
This is a behavior change since we migrated to the new CLI infra. Previously we were "force closing" the process in case to prevent hanging handlers/listeners. Modules should probably close their handler via I think we should add it back with also an explicit warning. But also only do it when using |
Any movement on this? Does Nuxt 3.8 solve these issues? |
@davestewart unfortunately not. Tried it on 3.8 release day and the process is still hanging :( |
…script in package.json
has this been resolved or do I need to use this workaround still? |
Nope. Seems like still unresolved even on the latest release. :( |
For anyone still encountering this, a reminder that this typically occurs because of non-Nuxt code, typically within modules, but it can be anything that leaves something un-cleaned-up, such as a watcher. I apologise for it taking so long, but I did eventually 🙈 take a look at Dave's module and prepared this PR, linked in case it's useful for anyone: davestewart/nuxt-content-assets#65. I did look into it further and also found this issue with Nitro, which was likely also at play: nitrojs/nitro#2287 After that merges, I think we can close this issue, but if you're still encountering something like this in your project after that point, please open a new issue with a reproduction and I'll happily look into it further 🙏 |
You can try the prerenderer fix using nightly release channel as @danielroe summarized this issue most of the times happens due to open handlers or watchers in modules. |
Great work (as usual) @danielroe! I might also suggest to add some additional documentation around this. Often as a module developer we're just focused on mainly getting something to work (i.e. the watch) and may either not think about the unwatch, or just not know enough about the wider context of the difference between build, dev, or in this case some change between Nuxt versions, which would blow up at some later date. If – as a core developer – you suspect a footgun, please document to the lowest common denominator! I can see that unwatch is documented, but in the bowels of developing a Nuxt plugin, triggered by Nitro, and leveraging unstorage, could there be any way to preempt showstoppers like this? Maybe a gotchas or best practices for module developers in Nuxt docs? Or, is the cycle of bugs > issues > debugging > repeating, etc just the way it is ? |
<!-- ☝️ PR title should follow conventional commits (https://conventionalcommits.org). In particular, the title should start with one of the following types: - docs: 📖 Documentation (updates to the documentation or readme) - fix: 🐞 Bug fix (a non-breaking change that fixes an issue) - feat: ✨ New feature/enhancement (a non-breaking change that adds functionality or improves existing one) - feat!/fix!:⚠️ Breaking change (fix or feature that would cause existing functionality to change) - chore: 🧹 Chore (updates to the build process or auxiliary tools and libraries) --> ### 🔗 Linked issue nuxt/cli#193 <!-- If it resolves an open issue, please link the issue here. For example "Resolves #123" --> ### 📚 Description The commit removes a workaround for a specific issue with Nuxt.js. The issue has been resolved, so the workaround is no longer necessary. <!-- Describe your changes in detail --> <!-- Why is this change required? What problem does it solve? -->
Environment
Reproduction
https://stackblitz.com/edit/github-c8qlr3?file=server%2Fplugins%2Ftest.ts
Describe the bug
If we add the page to routeRules (
prerender: true
) and start some timer/listener in the Nitro plugin, the process does not close after the build.Also
nitro.hooks.hook('close', () => {})
will never be called.Additional context
It was working fine on Nuxt 3.6.5.
Temporary workaround (UPDATED):
Logs
No response
The text was updated successfully, but these errors were encountered: