我正在使用具有“appDir”实验功能的 NextJs 13
在部署到 firebase 托管时,动态路由变为静态路径。
例如:
路径
app/[slug]/page.jsx
变成http://example.web.app/[slug]
你可以看到 [slug] 被认为是静态页面
重现步骤
npx create-next-app@latest --experimental-app
app/[slug]/page.jsx
.firebase experiments:enable webframeworks
firebase init hosting
然后firebase deploy
http://your-domain.web.app/hello
,你会看到页面未找到但http://example.web.app/[slug]
正在工作。在
firebase.json
{
"hosting": {
"source": ".",
"cleanUrls": false,
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
在
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
module.exports = nextConfig
在
jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
我对 aws amplify 也有类似的问题。