Files
2024-09-27 01:32:49 +08:00

75 lines
2.1 KiB
TypeScript

import path from 'path';
import { defineConfig } from 'umi';
import routes from './src/routes/index';
export default defineConfig({
nodeModulesTransform: {
type: 'none',
},
// 开启分包
// dynamicImport: {
// loading: resolve('src/components/loading/loading.tsx'),
// },
publicPath: './',
history: { type: 'hash' },
// 启动自定义配置
runtimePublicPath: true,
// 开启dva模式
dva: {},
routes: routes,
// 目录别名方便引入
alias: {
'@service': resolve('src/core/service/imp'),
'@assets': resolve('src/assets'),
'@components': resolve('src/components'),
'@less': resolve('src/assets/less'),
'@annotation': resolve('src/core/annotation'),
'@Ioc': resolve('src/core/Ioc'),
},
// 额外的css
styles: [`.selectOption .ant-select-item-option-content { word-wrap: break-word; white-space: normal;}`],
// 需要兼容的最低版本
targets: { chrome: 49, firefox: 64, safari: 10, edge: 13, ios: 10 },
// proxy: {
// "/api": {
// "target": "https://pvp.qq.com",
// "changeOrigin": true,
// "pathRewrite": { "^/api": "" }
// }
// }
plugins: ['@alitajs/hd'],
// 开启rem配置参考https://github.com/alitajs/alita/tree/master/packages/hd#readme或者看声明文件中的参数
// hd: {
// rootValue: 75,
// propBlackList: [], //不需要转换的属性
// selectorBlackList: [], //以包含***的class不需要转换
// },
extraPostCSSPlugins: [],
// 提取公共依赖
// chainWebpack: function (config, { webpack }) {
// config.merge({
// optimization: {
// minimize: true,
// splitChunks: {
// chunks: 'all',
// minSize: 30000,
// minChunks: 3,
// automaticNameDelimiter: '.',
// cacheGroups: {
// vendor: {
// name: 'vendors',
// test({ resource }) {
// return /[\\/]node_modules[\\/]/.test(resource);
// },
// priority: 10,
// },
// },
// },
// }
// });
// },
});
function resolve(dir: string) {
return path.join(__dirname, dir);
}