【发布时间】:2022-11-02 18:53:56
【问题描述】:
我在两个应用程序之间设置了多区域:
- 首页应用
- 博客应用
当我在博客应用程序的页面上并尝试使用Link 或router.push("/") 链接回主页应用程序时,它会将我带到博客应用程序的基本路径。
在 next.config.js 中,我将其设置如下:
/** @type {import('next').NextConfig} */
const withTM = require('next-transpile-modules')(['@workflow/shared-core']);
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
experimental: {
externalDir: true
},
basePath: '/blog',
rewrites: async () => {
return [
{
source: "/",
destination: "http://localhost:5001",
basePath: false
}
]
}
}
module.exports = withTM(nextConfig)
我的理解是,当在 basePath 设置为 false 的情况下设置重写时,它将完全回退目标属性中的 URL。
有任何想法吗?
【问题讨论】:
标签: next.js