|
|
@@ -1,14 +1,17 @@
|
|
|
import { IConfig, IPlugin } from 'umi-types';
|
|
|
import defaultSettings from './defaultSettings'; // https://umijs.org/config/
|
|
|
-
|
|
|
import slash from 'slash2';
|
|
|
-import webpackPlugin from './plugin.config';
|
|
|
+import themePluginConfig from './themePluginConfig';
|
|
|
+
|
|
|
+// import darkTheme from '@ant-design/dark-theme';
|
|
|
+
|
|
|
const { pwa, primaryColor } = 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, TEST } = process.env;
|
|
|
const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
|
|
|
+
|
|
|
const plugins: IPlugin[] = [
|
|
|
[
|
|
|
'umi-plugin-react',
|
|
|
@@ -37,8 +40,7 @@ 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'],
|
|
|
@@ -55,15 +57,55 @@ const plugins: IPlugin[] = [
|
|
|
autoAddMenu: true,
|
|
|
},
|
|
|
],
|
|
|
-]; // 针对 preview.pro.ant.design 的 GA 统计代码
|
|
|
+];
|
|
|
|
|
|
if (isAntDesignProPreview) {
|
|
|
+ // 针对 preview.pro.ant.design 的 GA 统计代码
|
|
|
plugins.push([
|
|
|
'umi-plugin-ga',
|
|
|
{
|
|
|
code: 'UA-72788897-6',
|
|
|
},
|
|
|
]);
|
|
|
+ plugins.push(['umi-plugin-antd-theme', themePluginConfig]);
|
|
|
+}
|
|
|
+
|
|
|
+if (!TEST) {
|
|
|
+ plugins.push([
|
|
|
+ 'umi-plugin-antd-theme',
|
|
|
+ {
|
|
|
+ theme: [
|
|
|
+ {
|
|
|
+ key: 'dark',
|
|
|
+ fileName: 'dark.css',
|
|
|
+ theme: 'dark',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'dust',
|
|
|
+ fileName: 'dust.css',
|
|
|
+ modifyVars: {
|
|
|
+ '@primary-color': '#F5222D',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'dust',
|
|
|
+ theme: 'dark',
|
|
|
+ fileName: 'dark-dust.css',
|
|
|
+ modifyVars: {
|
|
|
+ '@primary-color': '#F5222D',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'volcano',
|
|
|
+ theme: 'dark',
|
|
|
+ fileName: 'dark-volcano.css',
|
|
|
+ modifyVars: {
|
|
|
+ '@primary-color': '#FA541C',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]);
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
@@ -134,6 +176,7 @@ export default {
|
|
|
],
|
|
|
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
|
|
|
theme: {
|
|
|
+ // ...darkTheme,
|
|
|
'primary-color': primaryColor,
|
|
|
},
|
|
|
define: {
|
|
|
@@ -179,14 +222,12 @@ export default {
|
|
|
manifest: {
|
|
|
basePath: '/',
|
|
|
},
|
|
|
- chainWebpack: webpackPlugin,
|
|
|
- /*
|
|
|
- proxy: {
|
|
|
- '/server/api/': {
|
|
|
- target: 'https://preview.pro.ant.design/',
|
|
|
- changeOrigin: true,
|
|
|
- pathRewrite: { '^/server': '' },
|
|
|
- },
|
|
|
- },
|
|
|
- */
|
|
|
+ // chainWebpack: webpackPlugin,
|
|
|
+ // proxy: {
|
|
|
+ // '/server/api/': {
|
|
|
+ // target: 'https://preview.pro.ant.design/',
|
|
|
+ // changeOrigin: true,
|
|
|
+ // pathRewrite: { '^/server': '' },
|
|
|
+ // },
|
|
|
+ // },
|
|
|
} as IConfig;
|