-
-
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
allow disabling client-side JS entirely #14765
Comments
Pure HTML is not a normal output mode. We were considering it with @atinux since Nuxt 2 but finally decided to not introduce but i really love this idea specially combined with reactive component islands. We can probably have a module to try this mode ahead of time. Later can be joined with route rules to set per page (or group of pages) bases. Also good point about detection! What about a magical |
This is great, just like building islands, non-interactive and interactive loading of js scripts. This will improve very high performance and resource size. |
It'd be great to see it in the core with some sort of support for island hydration |
Yes, this is the beginning of a revolution |
This would be the key feature for us not to switch to Astro |
I have written post-build hacks to do this in nuxt 2 and it is a real pain point. Kudos @danielroe |
Support nuxt2? |
You can do this in Nuxt 2 by setting |
The feature looks great, it would be amazing to use it per route! |
Having absolutely no JS is not useful; we need some JS in header or in button to toggle dark mode. It would be better to have this feature per component, like in Astro. By default, global setting will render no JS, but with JS option set in particular component, Nuxt could enable JS for only those components. |
I found a use for "No JS" on the client site when trying to take a static SSG site offline and reroute all pages to a maintenance page by rerouting on the server itself. I tried using Netlify's _redirect folder, and while it worked, the nuxt app will hydrate and automatically try routing to the initial route (which reversed the configured server behavior). Since the deployment is truly static, this should work, but there's no way to fix it other than create a middleware/hook that hijacks and reroutes all existing routes to the desired page because Nuxt's default client-side behavior always kicks in. This causes at least two extra redirects, and crawlers don't get the intended redirect status code configured on the server. The problem has more to do with Nuxt's routing behavior, but that's expected and cannot/shouldn't be overridden. There should be a way to disable hydration on the first load or per route for SSG sites. |
Just seeing that this has already been implemented. You'll need to add this to your nuxt config file to get it working. features: { |
For some use cases, users may wish to have a purely HTML + CSS website where interactivity is not required. Shipping JS to hydrate such a site is unneeded.
For these use cases, we could consider support a top level option (or a per-path route rule) to disable rendering JS preload hints + script tags within the renderer.
Some initial steps:
Note: We may also need to update https://github.com/nuxtlabs/vue-telescope-api to accurately detect Nuxt on such sites. At the moment, it is unaware that https://nuxt.new/ is built with Nuxt 😆
The text was updated successfully, but these errors were encountered: