-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
asyncScripts
_breaks_ nuxtServerInit
#27459
Comments
Thank you for raising this - and you're right that it's unlikely we can resolve this in the time frame... It also might not be soluble at all, as you indicate. If you are able to investigate and submit a PR, either in code or docs, that would certainly be welcome. |
As a workaround you can probably rename nuxtServerInit to any name and call it in plugin with process.server validation. As I can remember it should work great. |
We are approaching the Nuxt 2 EOL date (June 30, 2024) - see this article for more information. This is advance warning that I'm going to close this issue then, as it's currently marked as a Nuxt 2 related bug. If it's a critical or security issue, please do comment and let me know, in case it is possible to address it before the EOL date. If it's a an issue you think is relevant for Nuxt 3, please feel free to open a fresh issue (or just comment here so I can update labels, etc.). 🙏 Thank you for your understanding and for your contribution to Nuxt. ❤️ |
It's the day, at last. Nuxt 2 is now marked end-of-life. My apologies we never got round to resolving this bug in the 2.x branch, but we do have to draw a line somewhere. Again, if you think this is still relevant for Nuxt going forward, please feel free to open a fresh issue (or just comment here so I can update labels, etc.). 🙏 |
Environment
System:
OS: Linux 6.1 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (2) x64 AMD EPYC
Memory: 2.00 GB / 4.01 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 20.12.1 - /home/codespace/nvm/current/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 10.5.0 - /home/codespace/nvm/current/bin/npm
pnpm: 8.15.6 - /home/codespace/nvm/current/bin/pnpm
npmPackages:
nuxt: 2.17.3 => 2.17.3
Reproduction
yarn generate
to statically build the siteyarn start
to serve the sitelocal
as the site's subtitle (should always beproduction
btw)Describe the bug
When enabling
render.asyncScripts
to improve performance, it seems that sometimes the page/component code can run beforenuxtServerInit
(race condition I guess).Not sure there is anything that can be easily done to ensure the store code always runs first.
Additional context
EOL is less than 30 days away so I'm pretty sure everyone will appreciate this issue being open 😃
If this is not something that can be easily fixed, I think it is okay to just leave a mention on both sides the docs (
asyncScripts
andnuxtServerInit
).Logs
No response
The text was updated successfully, but these errors were encountered: