Static export without clientside JavaScript #34065
callumlocke
started this conversation in
Ideas
Replies: 1 comment
-
|
That would be amazing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
For certain projects, I want the lightness of a pure HTML and CSS static website build, with no clientside JS. These projects can have multiple pages that use shared components (so Next is still a good fit) but the components are all pure and simple so there's no need for clientside hydration.
It's already possible to extend
Documentand omit the<NextScript />tag when rendering. But this has a shortcoming: clientside JS chunks are still included in the build output, and more importantly, they are still downloaded to the client because of<link rel="preload">tags rendered by Next's<Head />component, wasting bandwidth.Describe the solution you'd like
A flag on
next build(or an alternative command) that tells Next not to generate any clientside script bundles/chunks at all during build.<NextScript />would therefore render nothing, and<Head />wouldn't render any preload links.Describe alternatives you've considered
It looks like it's possible to create your own alternative
Headcomponent that omits the preload links, and I've tried this, but it feels a bit brittle/unsupported, and clientside chunks are still built unnecessarily. Ideally I'd like a formal way to say "no clientside JS please".Beta Was this translation helpful? Give feedback.
All reactions