admin管理员组文章数量:1405333
I'm working on a project where they chose to use nextJS as a client side tool, but I want to deploy the client as static code somewhere else.
Doing a build creates a folder with all the nextJS proprietary server stuff.
Is there a way to make a normal build to just static react files? I don't want SSR or any of their EEE stuff.
I know Vercel is a VC backed mousetrap, so it's not really in their interest to make it easy to extract yourself, but hoping we don't have to rebuild the site to get out of this.
I'm working on a project where they chose to use nextJS as a client side tool, but I want to deploy the client as static code somewhere else.
Doing a build creates a folder with all the nextJS proprietary server stuff.
Is there a way to make a normal build to just static react files? I don't want SSR or any of their EEE stuff.
I know Vercel is a VC backed mousetrap, so it's not really in their interest to make it easy to extract yourself, but hoping we don't have to rebuild the site to get out of this.
Share Improve this question asked Oct 4, 2022 at 19:19 dcsandcsan 12.3k17 gold badges92 silver badges139 bronze badges2 Answers
Reset to default 4Update your build script in package.json
to use next export
:
"scripts": {
"build": "next build && next export"
}
Note: this feature does not support the following:
- Image Optimization (default loader)
- Internationalized Routing
- API Routes
- Rewrites
- Redirects
- Headers
- Middleware
- Incremental Static Regeneration
fallback: true
getServerSideProps
If you are using any of the features listed above, you will have to stick to prerendering individual pages, which Next automatically does for you.
Source: Docs
UPDATE February 2024: the configuration to for static exports has changed, slightly. Refer to the latest Next.js docs for details.
Sounds like you are looking for the next export
. Should do just that, but there are some limitations. Documentation is here: https://nextjs/docs/advanced-features/static-html-export
本文标签: javascripthow to make a standalone build when using nextJSStack Overflow
版权声明:本文标题:javascript - how to make a standalone build when using nextJS? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744330549a2600944.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论