TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: I built a library to host your Next.js app statically on S3/CloudFront

2 点作者 zdenham11 个月前
As the next.js server-less feature set has become more robust, I find myself reaching for the static site generation feature more often than not.<p>Static hosting is cheaper, and significantly reduces the underlying infrastructure overhead &#x2F; risk of hosting your site. It also cuts the switching cost if you every need to change providers.<p>That being said, dynamic routes don’t work the way you would expect with the latest app router + SSG, and most static hosting providers (e.g. S3 + Cloudfront) don’t handle routing with next.js code splitting properly out of the box.<p>After running into these issues with a few projects, I bit the bullet and hacked together next-static-utils to make it simpler to port your next.js site to any static hosting provider, starting with S3 + cloudfront, which suited my use case.<p>It works by generating “fallback pages” for the dynamic routes as well as a cloudfront edge function to handle properly routing requests to the fallbacks and avoiding dreaded 404s.<p>I’m using it for an admin dashboard where SEO &#x2F; SSR is not important, and we have a separate backend. Hope folks on HN find it useful too!

暂无评论

暂无评论