|
|
@@ -2,12 +2,13 @@ import { IConfig, IPlugin } from 'umi-types';
|
|
|
import defaultSettings from './defaultSettings'; // https://umijs.org/config/
|
|
|
import slash from 'slash2';
|
|
|
import themePluginConfig from './themePluginConfig';
|
|
|
+import proxy from './proxy';
|
|
|
|
|
|
const { pwa } = defaultSettings;
|
|
|
|
|
|
// 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 } = process.env;
|
|
|
+const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, REACT_APP_ENV } = process.env;
|
|
|
const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
|
|
|
|
|
|
const plugins: IPlugin[] = [
|
|
|
@@ -39,7 +40,8 @@ const plugins: IPlugin[] = [
|
|
|
importWorkboxFrom: 'local',
|
|
|
},
|
|
|
}
|
|
|
- : false, // default close dll, because issue https://github.com/ant-design/ant-design-pro/issues/4665
|
|
|
+ : false,
|
|
|
+ // default close dll, because issue https://github.com/ant-design/ant-design-pro/issues/4665
|
|
|
// dll features https://webpack.js.org/plugins/dll-plugin/
|
|
|
// dll: {
|
|
|
// include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
|
|
|
@@ -143,6 +145,7 @@ export default {
|
|
|
// ...darkTheme,
|
|
|
},
|
|
|
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 专用环境变量,请不要在你的项目中使用它。
|
|
|
},
|
|
|
@@ -167,9 +170,7 @@ export default {
|
|
|
) {
|
|
|
return localName;
|
|
|
}
|
|
|
-
|
|
|
const match = context.resourcePath.match(/src(.*)/);
|
|
|
-
|
|
|
if (match && match[1]) {
|
|
|
const antdProPath = match[1].replace('.less', '');
|
|
|
const arr = slash(antdProPath)
|
|
|
@@ -178,19 +179,11 @@ export default {
|
|
|
.map((a: string) => a.toLowerCase());
|
|
|
return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
|
|
|
}
|
|
|
-
|
|
|
return localName;
|
|
|
},
|
|
|
},
|
|
|
manifest: {
|
|
|
basePath: '/',
|
|
|
},
|
|
|
- // chainWebpack: webpackPlugin,
|
|
|
- // proxy: {
|
|
|
- // '/server/api/': {
|
|
|
- // target: 'https://preview.pro.ant.design/',
|
|
|
- // changeOrigin: true,
|
|
|
- // pathRewrite: { '^/server': '' },
|
|
|
- // },
|
|
|
- // },
|
|
|
+ proxy: proxy[REACT_APP_ENV || 'dev'],
|
|
|
} as IConfig;
|