| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- import { defineConfig } from '@umijs/max';
- import keepAlive from './keep-alive';
- import { extraMfsuExclude } from './mfsu.extensions';
- import { compressionPluginConfig, monacoPluginConfig } from './plugins';
- import proxy from './proxy';
- import routes from './routes';
- import { getBranchInfo } from './utils';
- const versionInfo = getBranchInfo();
- process.env.VERSION = JSON.stringify(versionInfo);
- const env = process.env.NODE_ENV;
- const isProduction = env === 'production';
- const t = Date.now();
- export default defineConfig({
- proxy: {
- ...proxy(process.env.PROXY_HOST)
- },
- history: {
- type: 'browser'
- },
- define: {
- 'process.env.ENABLE_ENTERPRISE': process.env.ENABLE_ENTERPRISE,
- 'process.env.APP_TITLE': process.env.APP_TITLE || '',
- 'process.env.ENABLE_PLAYGROUND': JSON.stringify(
- process.env.ENABLE_PLAYGROUND ?? 'true'
- )
- },
- analyze: {
- analyzerMode: 'server',
- analyzerPort: 8888,
- openAnalyzer: true,
- generateStatsFile: false,
- statsFilename: 'stats.json',
- logLevel: 'info',
- defaultSizes: 'parsed' // stat // gzip
- },
- mfsu: {
- exclude: ['lodash', 'ml-pca', ...extraMfsuExclude]
- },
- base: process.env.npm_config_base || '/',
- ...(isProduction
- ? {
- jsMinifierOptions: {
- compress: {
- drop_console: true,
- drop_debugger: true
- }
- },
- scripts: [
- {
- src: `/js/umi.${t}.js`
- }
- ],
- chainWebpack(config: any) {
- config.plugin('mini-css-extract-plugin').tap((args: any) => [
- {
- ...args[0],
- filename: `css/[name].${t}.css`,
- chunkFilename: `css/[name].${t}.chunk.css`
- }
- ]);
- config.output
- .filename(`js/[name].${t}.js`)
- .chunkFilename(`js/[name].${t}.chunk.js`);
- compressionPluginConfig(config);
- monacoPluginConfig(config);
- }
- }
- : {
- chainWebpack(config) {
- monacoPluginConfig(config);
- }
- }),
- favicons: ['/static/favicon.png'],
- jsMinifier: 'terser',
- cssMinifier: 'cssnano',
- presets: ['umi-presets-pro'],
- clickToComponent: {},
- antd: {
- style: 'less'
- },
- title: process.env.APP_TITLE || '网讯创智MaaS底座',
- hash: true,
- access: {},
- model: {},
- initialState: {},
- request: {},
- routePrefetch: {
- defaultPrefetch: 'intent'
- },
- keepalive: keepAlive,
- locale: {
- antd: true,
- baseNavigator: true,
- baseSeparator: '-',
- default: 'en-US',
- title: false,
- useLocalStorage: true
- },
- layout: false,
- routes,
- npmClient: 'pnpm'
- }) as any;
|