nextjs13 中应用程序目录中的动态路由在部署到 firebase 托管后无法正常工作

问题描述 投票:0回答:1

我正在使用具有“appDir”实验功能的 NextJs 13
在部署到 firebase 托管时,动态路由变为静态路径。
例如:
路径

app/[slug]/page.jsx
变成
http://example.web.app/[slug]

你可以看到 [slug] 被认为是静态页面

重现步骤

  1. 创建 nextjs13 应用程序
    npx create-next-app@latest --experimental-app
  2. 创建
    app/[slug]/page.jsx
    .
  3. 启用
    firebase experiments:enable webframeworks
  4. 确保启用计费。
  5. firebase init hosting
    然后
    firebase deploy
  6. 成功部署后,检查
    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": {
      "@/*": ["./*"]
    }
  }
}
firebase next.js firebase-hosting firebase-tools nextjs-dynamic-routing
1个回答
0
投票

我对 aws amplify 也有类似的问题。

© www.soinside.com 2019 - 2024. All rights reserved.