You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.6 KiB
TypeScript
104 lines
2.6 KiB
TypeScript
11 months ago
|
//import { commonConfig } from 'qiankun-common';
|
||
|
import { defineConfig } from 'umi';
|
||
|
import defaultSettings from './defaultSettings';
|
||
|
import proxy from './proxy';
|
||
|
import routes from './routes';
|
||
|
//import util from "../src/microhost/common"
|
||
|
import {defaultSetting as cfg} from "../src/config/default"
|
||
|
import {parseTheme} from "./theme"
|
||
|
|
||
|
const scriptsDev = [
|
||
|
"https://gw.alipayobjects.com/os/lib/react/16.8.6/umd/react.development.js",
|
||
|
"https://gw.alipayobjects.com/os/lib/react-dom/16.8.6/umd/react-dom.development.js",
|
||
|
"https://cdn.bootcdn.net/ajax/libs/moment.js/2.25.3/moment.js",
|
||
|
];
|
||
|
const scriptsProd = [
|
||
|
"https://gw.alipayobjects.com/os/lib/react/16.8.6/umd/react.production.min.js",
|
||
|
"https://gw.alipayobjects.com/os/lib/react-dom/16.8.6/umd/react-dom.production.min.js",
|
||
|
"https://cdn.bootcdn.net/ajax/libs/moment.js/2.25.3/moment.min.js",
|
||
|
];
|
||
|
|
||
|
const commonConfig = {
|
||
|
scripts: process.env.NODE_ENV === "development" ? scriptsDev : scriptsProd,
|
||
|
externals: { react: "React", "react-dom": "ReactDOM", moment: "moment" },
|
||
|
chunks: process.env.NODE_ENV === "production" ? ["vendors", "umi"] : ["umi"],
|
||
|
chainWebpack: function (config, { webpack }) {
|
||
|
if (process.env.NODE_ENV === "production") {
|
||
|
config.merge({
|
||
|
optimization: {
|
||
|
splitChunks: {
|
||
|
chunks: "all",
|
||
|
minSize: 30000,
|
||
|
minChunks: 3,
|
||
|
automaticNameDelimiter: ".",
|
||
|
cacheGroups: {
|
||
|
vendor: {
|
||
|
name: "vendors",
|
||
|
test({ resource }) {
|
||
|
return /[\\/]node_modules[\\/]/.test(resource);
|
||
|
},
|
||
|
priority: 10,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const { REACT_APP_ENV } = process.env;
|
||
|
const themeName = "ant"
|
||
|
|
||
|
export default defineConfig({
|
||
|
hash: true,
|
||
|
antd: {},
|
||
|
dva: { hmr: true},
|
||
|
//chunks: commonConfig.chunks,
|
||
|
//chainWebpack: commonConfig.chainWebpack,
|
||
|
//externals: [],//commonConfig.externals,
|
||
|
//scripts: [],//commonConfig.scripts,
|
||
|
qiankun: {
|
||
|
master: {
|
||
|
defer: true,
|
||
|
sandbox: true, //是否启用沙箱
|
||
|
prefetch: true, //是否启用prefetch特性
|
||
|
}
|
||
|
},
|
||
|
history: {
|
||
|
type: 'browser',
|
||
|
},
|
||
|
nodeModulesTransform: {
|
||
|
type: 'none',
|
||
|
exclude: [],
|
||
|
},
|
||
|
locale: {
|
||
|
default: 'zh-CN',
|
||
|
antd: true,
|
||
|
baseNavigator: true,
|
||
|
},
|
||
|
dynamicImport: {
|
||
|
//loading: '@/components/PageLoading/index',
|
||
|
loading: "@/microhost/components/pageLoading",
|
||
|
},
|
||
|
targets: {
|
||
|
ie: 11,
|
||
|
},
|
||
|
routes,
|
||
|
// theme: parseTheme(),
|
||
|
theme: {
|
||
|
'@primary-color': '#3552bb',//defaultSettings.primaryColor,
|
||
|
'@ant-prefix': "ant",
|
||
|
},
|
||
|
title: false,
|
||
|
ignoreMomentLocale: true,
|
||
|
proxy: proxy,
|
||
|
manifest: {
|
||
|
basePath: '/',
|
||
|
},
|
||
|
//mfsu: {},
|
||
|
fastRefresh: {},
|
||
|
esbuild: {},
|
||
|
//webpack5: {},
|
||
|
});
|