|
|
@@ -1,19 +1,13 @@
|
|
|
// https://umijs.org/config/
|
|
|
-import { defineConfig, utils } from 'umi';
|
|
|
+import { defineConfig } from 'umi';
|
|
|
import defaultSettings from './defaultSettings';
|
|
|
import proxy from './proxy';
|
|
|
-import webpackPlugin from './plugin.config';
|
|
|
|
|
|
-const { winPath } = utils;
|
|
|
-
|
|
|
-// preview.pro.ant.design only do not use in your production ;
|
|
|
-// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
|
|
|
-const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, REACT_APP_ENV, GA_KEY } = process.env;
|
|
|
+const { REACT_APP_ENV } = process.env;
|
|
|
|
|
|
export default defineConfig({
|
|
|
hash: true,
|
|
|
antd: {},
|
|
|
- analytics: GA_KEY ? { ga: GA_KEY } : false,
|
|
|
dva: {
|
|
|
hmr: true,
|
|
|
},
|
|
|
@@ -103,47 +97,9 @@ export default defineConfig({
|
|
|
// ...darkTheme,
|
|
|
'primary-color': defaultSettings.primaryColor,
|
|
|
},
|
|
|
- define: {
|
|
|
- REACT_APP_ENV: REACT_APP_ENV || false,
|
|
|
- ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
|
|
|
- ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
|
|
|
- },
|
|
|
ignoreMomentLocale: true,
|
|
|
- lessLoader: {
|
|
|
- javascriptEnabled: true,
|
|
|
- },
|
|
|
- cssLoader: {
|
|
|
- modules: {
|
|
|
- getLocalIdent: (
|
|
|
- context: {
|
|
|
- resourcePath: string;
|
|
|
- },
|
|
|
- _: string,
|
|
|
- localName: string,
|
|
|
- ) => {
|
|
|
- if (
|
|
|
- context.resourcePath.includes('node_modules') ||
|
|
|
- context.resourcePath.includes('ant.design.pro.less') ||
|
|
|
- context.resourcePath.includes('global.less')
|
|
|
- ) {
|
|
|
- return localName;
|
|
|
- }
|
|
|
- const match = context.resourcePath.match(/src(.*)/);
|
|
|
- if (match && match[1]) {
|
|
|
- const antdProPath = match[1].replace('.less', '');
|
|
|
- const arr = winPath(antdProPath)
|
|
|
- .split('/')
|
|
|
- .map((a: string) => a.replace(/([A-Z])/g, '-$1'))
|
|
|
- .map((a: string) => a.toLowerCase());
|
|
|
- return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
|
|
|
- }
|
|
|
- return localName;
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
+ proxy: proxy[REACT_APP_ENV || 'dev'],
|
|
|
manifest: {
|
|
|
basePath: '/',
|
|
|
},
|
|
|
- proxy: proxy[REACT_APP_ENV || 'dev'],
|
|
|
- chainWebpack: webpackPlugin,
|
|
|
});
|