|
|
@@ -6,6 +6,7 @@ import defaultSettings from '../src/defaultSettings';
|
|
|
import slash from 'slash2';
|
|
|
|
|
|
const { pwa, primaryColor } = defaultSettings;
|
|
|
+const { NODE_ENV, APP_TYPE, TEST } = process.env;
|
|
|
|
|
|
const plugins = [
|
|
|
[
|
|
|
@@ -32,7 +33,7 @@ const plugins = [
|
|
|
},
|
|
|
}
|
|
|
: {},
|
|
|
- ...(!process.env.TEST && os.platform() === 'darwin'
|
|
|
+ ...(!TEST && os.platform() === 'darwin'
|
|
|
? {
|
|
|
dll: {
|
|
|
include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
|
|
|
@@ -47,7 +48,7 @@ const plugins = [
|
|
|
|
|
|
// 针对 preview.pro.ant.design 的 GA 统计代码
|
|
|
// 业务上不需要这个
|
|
|
-if (process.env.APP_TYPE === 'site') {
|
|
|
+if (APP_TYPE === 'site') {
|
|
|
plugins.push([
|
|
|
'umi-plugin-ga',
|
|
|
{
|
|
|
@@ -60,7 +61,7 @@ export default {
|
|
|
// add for transfer to umi
|
|
|
plugins,
|
|
|
define: {
|
|
|
- APP_TYPE: process.env.APP_TYPE || '',
|
|
|
+ APP_TYPE: APP_TYPE || '',
|
|
|
},
|
|
|
treeShaking: true,
|
|
|
targets: {
|
|
|
@@ -75,6 +76,10 @@ export default {
|
|
|
},
|
|
|
externals: {
|
|
|
'@antv/data-set': 'DataSet',
|
|
|
+ // if is production externals react react-dom and bizcharts
|
|
|
+ ...(NODE_ENV === 'production'
|
|
|
+ ? { react: 'React', 'react-dom': 'ReactDOM', bizcharts: 'BizCharts' }
|
|
|
+ : {}),
|
|
|
},
|
|
|
// proxy: {
|
|
|
// '/server/api/': {
|