-
我们项目有个需求是要把资源托管到cdn,并支持cdn访问失败时回退到之前的url。 也就是生成的index.html中,umi打包进去的"./umi.js"和"./umi.css"需要修改为"https://cdn.cn/umi.js","https://cdn.cn/umi.css" 有没有什么api或钩子函数可以修改打包后输出的umi.js和umi.css路径的? |
Beta Was this translation helpful? Give feedback.
Answered by
fz6m
Nov 20, 2023
Replies: 1 comment 2 replies
-
产物的静态资源 // .umirc.ts
publicPath: process.env.NODE_ENV === 'production' ? 'https://domain.com/path/' : '/' |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
xiaohuoni
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
产物的静态资源
dist
整个文件夹发到 CDN 上的话,要配publicPath
,比如配了https://domain.com/path/
,最后就会从https://domain.com/path/umi.js
加载: