cam*_*nch 5 static-site netlify next.js
我一直致力于实现Next 9.3 的一些更新。我一直在移动getInitialProps,getServerSideProps并注意到我exportPathMap对这些页面变得动态变得不满意。运行一切正常next,但是当我去运行时next build && next export,我遇到了一些问题。
在文档的静态HTML导出它指出If your pages don't have getInitialProps you may not need next export at all; next build is already enough thanks to Automatic Static Optimization.我能得到那个工作愉快地与我的新getServerSideProps电话,当我运行next build && next start。我需要采取哪些步骤才能使其也适用,next export以便我可以通过 Netlify 进行部署。这是我尝试运行时遇到的错误示例next export
Error occurred prerendering page "/videos/[videos_title]". Read more: https://err.sh/next.js/prerender-error:
Error: Error for page /videos/[videos_title]: pages with `getServerSideProps` can not be exported. See more info here: https://err.sh/next.js/gssp-export
Run Code Online (Sandbox Code Playgroud)
使用 SSR 构建的应用程序不能部署在 Netlify 或任何其他静态托管站点(除了支持 NextJS SSR 部署的 Vercel)
当您选择 SSR(使用 getServerSideProps)时,使用该命令毫无意义,
next export因为它会尝试创建与 SSR 完全相反的静态内容。
Vercel 的 SSR 应用程序部署文档很差。幸运的是,我从支持团队那里获得了以下信息,并要求他们更新文档以详细说明 Vercel 中的 SSR 部署。
在 Vercel 中部署时,
next build或npm run build注意:带有自定义 server.js 的应用程序将无法在 Vercel 中正常工作,在这种情况下,请使用虚拟服务器(如 EC2)
| 归档时间: |
|
| 查看次数: |
1829 次 |
| 最近记录: |