Browse Source

fix: 解决 headScripts 链接与 publicPath 不匹配 (#11289)

pull/11357/head
jump-and-jump 2 years ago
committed by GitHub
parent
commit
e48e3143c2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      config/config.ts

11
config/config.ts

@ -7,6 +7,13 @@ import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env;
/**
* @name 使用公共路径
* @description 部署时的路径,如果部署在非根目录下,需要配置这个变量
* @doc https://umijs.org/docs/api/config#publicpath
*/
const PUBLIC_PATH: string = '/';
export default defineConfig({
/**
* @name 开启 hash 模式
@ -15,6 +22,8 @@ export default defineConfig({
*/
hash: true,
publicPath: PUBLIC_PATH,
/**
* @name 兼容性设置
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
@ -125,7 +134,7 @@ export default defineConfig({
*/
headScripts: [
// 解决首次加载时白屏的问题
{ src: '/scripts/loading.js', async: true },
{ src: join(PUBLIC_PATH, 'scripts/loading.js'), async: true },
],
//================ pro 插件配置 =================
presets: ['umi-presets-pro'],

Loading…
Cancel
Save