Closed huli66 closed 1 year ago
使用 dumi 2.2.0(node_modules/dumi/package.json 显示以来umi4.0.64),因为项目不是部署在根目录,所以设置了publicPath,配置如下
// .dumi.ts import { defineConfig } from "dumi"; import path from "path"; export default defineConfig({ chainWebpack(memo) { memo.plugins.delete("copy"); memo.resolve.alias.set( "quant-ui", path.resolve(__dirname, "packages/quant-ui/components/index.ts") ); memo.resolve.alias.set( "quant", path.resolve(__dirname, "packages/quant-ui") ); }, outputPath: "docsdist", themeConfig: { name: "quant-ui", socialLinks: { gitlab: "https://gitlab.quantinfotech.com/CommonService/frontend-lib", }, footer: `Copyright © 2023 | Powered by <a href="#">QuantInfoTech</a>`, nav: [ { title: "组件", link: "/components" }, { title: "文档", link: "/blog" }, { title: "监控", link: "/monitor" }, ], }, base: "/docsdist/", publicPath: process.env.NODE_ENV === "production" ? "/docsdist/" : "/", runtimePublicPath: {}, mfsu: false, resolve: { // docDirs: ["docs"], atomDirs: [{ type: "component", dir: "packages/quant-ui/components" }], codeBlockMode: "passive", }, });
打包后效果如下 对蓝色框住的请求都加上了/docsdist,请求成功,红色框框住的没有生效 请教一下,我该如何解决这个问题
把 runtimePublicPath 删了看看,开启这个之后 publicPath 就不由你配置的决定了。
runtimePublicPath
publicPath
background
使用 dumi 2.2.0(node_modules/dumi/package.json 显示以来umi4.0.64),因为项目不是部署在根目录,所以设置了publicPath,配置如下
打包后效果如下 对蓝色框住的请求都加上了/docsdist,请求成功,红色框框住的没有生效 请教一下,我该如何解决这个问题