1

我正在使用 React/NextJS 创建一个最终将用作静态站点的应用程序。我已经预定义了需要在子目录中创建的 url。例如,/technology/应该去/technology/index.html

如何在 Nextjspages结构中创建它?

我尝试了以下各种组合,但没有运气:

  • 添加trailingSlash到我的 nextjs 配置中:
module.exports.trailingSlash = true;
  • 添加technology.js到我的页面目录(也尝试过/technology/index.js

  • 添加exportPathMap到我的 next.config.js:

exportPathMap: async function (
    defaultPathMap,
    { dev, dir, outDir, distDir, buildId }
  ) {
    return {
      '/': { page: '/' },
      '/technology/index.html': { page: '/technology' },
    };
  },
  trailingSlash: true
4

0 回答 0