Unverified Commit 65e822ea authored by 陈帅's avatar 陈帅 Committed by GitHub

feat: Officially traded will use cdn to optimize bizchart (#3535)

parent bd060c06
...@@ -6,6 +6,7 @@ import defaultSettings from '../src/defaultSettings'; ...@@ -6,6 +6,7 @@ import defaultSettings from '../src/defaultSettings';
import slash from 'slash2'; import slash from 'slash2';
const { pwa, primaryColor } = defaultSettings; const { pwa, primaryColor } = defaultSettings;
const { NODE_ENV, APP_TYPE, TEST } = process.env;
const plugins = [ const plugins = [
[ [
...@@ -32,7 +33,7 @@ const plugins = [ ...@@ -32,7 +33,7 @@ const plugins = [
}, },
} }
: {}, : {},
...(!process.env.TEST && os.platform() === 'darwin' ...(!TEST && os.platform() === 'darwin'
? { ? {
dll: { dll: {
include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
...@@ -47,7 +48,7 @@ const plugins = [ ...@@ -47,7 +48,7 @@ const plugins = [
// 针对 preview.pro.ant.design 的 GA 统计代码 // 针对 preview.pro.ant.design 的 GA 统计代码
// 业务上不需要这个 // 业务上不需要这个
if (process.env.APP_TYPE === 'site') { if (APP_TYPE === 'site') {
plugins.push([ plugins.push([
'umi-plugin-ga', 'umi-plugin-ga',
{ {
...@@ -60,7 +61,7 @@ export default { ...@@ -60,7 +61,7 @@ export default {
// add for transfer to umi // add for transfer to umi
plugins, plugins,
define: { define: {
APP_TYPE: process.env.APP_TYPE || '', APP_TYPE: APP_TYPE || '',
}, },
treeShaking: true, treeShaking: true,
targets: { targets: {
...@@ -75,6 +76,10 @@ export default { ...@@ -75,6 +76,10 @@ export default {
}, },
externals: { externals: {
'@antv/data-set': 'DataSet', '@antv/data-set': 'DataSet',
// if is production externals react react-dom and bizcharts
...(NODE_ENV === 'production'
? { react: 'React', 'react-dom': 'ReactDOM', bizcharts: 'BizCharts' }
: {}),
}, },
// proxy: { // proxy: {
// '/server/api/': { // '/server/api/': {
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
/> />
<title>Ant Design Pro</title> <title>Ant Design Pro</title>
<link rel="icon" href="/favicon.png" type="image/x-icon" /> <link rel="icon" href="/favicon.png" type="image/x-icon" />
<script src="https://gw.alipayobjects.com/os/antv/pkg/_antv.data-set-0.9.6/dist/data-set.min.js"></script> <% if(context.env === 'production') { %>
<script src="//gw.alipayobjects.com/os/lib/react/16.8.1/umd/react.production.min.js"></script>
<script src="//gw.alipayobjects.com/os/lib/react-dom/16.8.1/umd/react-dom.production.min.js"></script>
<script src="//gw.alipayobjects.com/os/lib/bizcharts/3.4.3/umd/BizCharts.min.js"></script>
<% }%>
<script src="https://gw.alipayobjects.com/os/lib/antv/data-set/0.10.1/dist/data-set.min.js"></script>
</head> </head>
<body> <body>
<noscript>Sorry, we need js to run correctly!</noscript> <noscript>Sorry, we need js to run correctly!</noscript>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment