diff --git a/config/config.js b/config/config.js index 9b500b298918a9f4a23bc66ea88cb1f05c93a87a..a7daaeed94681beadd81a0bb1ae5f2865f1aa0de 100644 --- a/config/config.js +++ b/config/config.js @@ -4,46 +4,51 @@ import pageRoutes from './router.config'; import webpackPlugin from './plugin.config'; import defaultSettings from '../src/defaultSettings'; -export default { - // add for transfer to umi - plugins: [ - [ - 'umi-plugin-react', - { - antd: true, - dva: { - hmr: true, - }, - targets: { - ie: 11, - }, - locale: { - enable: true, // default false - default: 'zh-CN', // default zh-CN - baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default - }, - dynamicImport: { - loadingComponent: './components/PageLoading/index', - }, - ...(!process.env.TEST && os.platform() === 'darwin' - ? { - dll: { - include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], - exclude: ['@babel/runtime'], - }, - hardSource: true, - } - : {}), +const plugins = [ + [ + 'umi-plugin-react', + { + antd: true, + dva: { + hmr: true, + }, + targets: { + ie: 11, }, - ], - [ - 'umi-plugin-ga', - { - code: 'UA-72788897-6', - judge: () => process.env.APP_TYPE === 'site', + locale: { + enable: true, // default false + default: 'zh-CN', // default zh-CN + baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default }, - ], + dynamicImport: { + loadingComponent: './components/PageLoading/index', + }, + ...(!process.env.TEST && os.platform() === 'darwin' + ? { + dll: { + include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], + exclude: ['@babel/runtime'], + }, + hardSource: true, + } + : {}), + }, ], +]; + +// judge add ga +if (process.env.APP_TYPE === 'site') { + plugins.push([ + 'umi-plugin-ga', + { + code: 'UA-72788897-6', + }, + ]); +} + +export default { + // add for transfer to umi + plugins, targets: { ie: 11, }, @@ -95,7 +100,7 @@ export default { }, }, manifest: { - basePath:"/" + basePath: '/', }, chainWebpack: webpackPlugin,