Closed webguicai closed 1 year ago
config.ts文件配置 publicPath: process.env.NODE_ENV === 'production' ? './' : '/',打包后不生效,会报Not allowed to load local resource: file:///C:/user/login
config.ts增加publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
打包后打开index.html不会报错,可以显示页面
// https://umijs.org/config/ import { defineConfig } from '@umijs/max'; import { join } from 'path'; import defaultSettings from './defaultSettings'; import proxy from './proxy'; import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env; export default defineConfig({ /**
@doc https://umijs.org/docs/api/config#hash */ hash: true,
/**
navigator.language
Ant Design Pro 版本: 6.0.0 umi 版本: 4.x 浏览器环境: Chrome 开发环境: node 16.19.0
无
当前 Issue 未检测到标题,请规范填写,谢谢!
The title of the current issue is not detected, please fill in according to the specifications, thank you!
🐛 bug 描述
config.ts文件配置 publicPath: process.env.NODE_ENV === 'production' ? './' : '/',打包后不生效,会报Not allowed to load local resource: file:///C:/user/login
📷 复现步骤 | Recurrence steps
config.ts增加publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
🏞 期望结果 | Expected results
打包后打开index.html不会报错,可以显示页面
💻 复现代码 | Recurrence code
// https://umijs.org/config/ import { defineConfig } from '@umijs/max'; import { join } from 'path'; import defaultSettings from './defaultSettings'; import proxy from './proxy'; import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env; export default defineConfig({ /**
@doc https://umijs.org/docs/api/config#hash */ hash: true,
/**
navigator.language
overwrite default baseNavigator: true, }, /**© 版本信息
Ant Design Pro 版本: 6.0.0 umi 版本: 4.x 浏览器环境: Chrome 开发环境: node 16.19.0
🚑 其他信息
无