在根路径的.umirc.ts 做配置
base: root, //部署到非根目录时才需配置
publicPath:root, //静态资源 —必须配置,不然静态资源出不来
/*
* @Author: muge
* @Date: 2021-12-29 10:41:57
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-12-31 10:18:08
*/
import { defineConfig } from 'umi';
import px2rem from 'postcss-plugin-px2rem';
import path from 'path';
import { domain } from './src/request/index';
const root:string = '/followup/'
export default defineConfig({
base: root, //部署到非根目录时才需配置
publicPath:root, //静态资源
targets: {
//配置浏览器最低版本,比如兼容ie11
ie: 9,
},
hash: true, //开启打包文件的hash值后缀
nodeModulesTransform: {
type: 'none',
},
metas: [{ charset: 'utf-8' }],
routes: [
{
path: '/',
component: '@/pages/index',
title: 'h5',
},
],
fastRefresh: {},
proxy: {
'/api': {
target: domain,
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
alias: {
'@': path.resolve(__dirname, 'src'),
},
extraPostCSSPlugins: [
px2rem({
rootValue:18.75 , // 兼容 ant mobile
propBlackList:['border','border-top','border-left','border-right','border-bottom','border-radius','font-size'],//这些属性不需要转换
}),
],
antd:{
mobile:false
}
});