静态导出
将你的页面静态导出,并可使用 Nginx 、GitHub Pages 等进行部署。
开始
配置
next.config.mjs
import nextra from 'nextra'
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: 'export',
images: {
unoptimized: true // mandatory, otherwise won't export
}
// Optional: Change the output directory `out` -> `dist`
// distDir: "build"
}
const withNextra = nextra({
// ... other Nextra config options
})
export default withNextra(nextConfig)
Building
运行 build
命令:
npm run build
默认情况下,静态导出将存储在项目根目录中的 out
文件夹中。
要了解更多关于静态导出的详细文档,请访问 Next.js 文档 .
Last updated on