site: dev use uncompressed bundle. close #7383 (#7472)

This commit is contained in:
paranoidjk 2017-09-06 09:19:35 +08:00 committed by Benjy Cui
parent 9667ec17bd
commit a73d0504ca
3 changed files with 15 additions and 3 deletions

View File

@ -89,7 +89,7 @@
"babel-preset-react": "^6.16.0", "babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0", "babel-preset-stage-0": "^6.16.0",
"bezier-easing": "^2.0.3", "bezier-easing": "^2.0.3",
"bisheng": "^0.24.0", "bisheng": "^0.25.0",
"bisheng-plugin-antd": "^0.15.0", "bisheng-plugin-antd": "^0.15.0",
"bisheng-plugin-description": "^0.1.1", "bisheng-plugin-description": "^0.1.1",
"bisheng-plugin-react": "^0.5.0", "bisheng-plugin-react": "^0.5.0",
@ -156,8 +156,8 @@
"dist": "antd-tools run dist", "dist": "antd-tools run dist",
"compile": "antd-tools run compile", "compile": "antd-tools run compile",
"tsc": "tsc", "tsc": "tsc",
"start": "bisheng start -c ./site/bisheng.config.js --no-livereload", "start": "cross-env NODE_ENV=development bisheng start -c ./site/bisheng.config.js --no-livereload",
"site": "bisheng build --ssr -c ./site/bisheng.config.js", "site": "cross-env NODE_ENV=production bisheng build --ssr -c ./site/bisheng.config.js",
"deploy": "antd-tools run clean && npm run site && bisheng gh-pages --push-only", "deploy": "antd-tools run clean && npm run site && bisheng gh-pages --push-only",
"pub": "antd-tools run pub", "pub": "antd-tools run pub",
"prepublish": "antd-tools run guard", "prepublish": "antd-tools run guard",

View File

@ -1,6 +1,8 @@
const path = require('path'); const path = require('path');
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default; const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;
const isDev = process.env.NODE_ENV === 'development';
module.exports = { module.exports = {
port: 8001, port: 8001,
source: { source: {
@ -61,6 +63,8 @@ module.exports = {
}; };
config.externals = { config.externals = {
react: 'React',
'react-dom': 'ReactDOM',
'react-router-dom': 'ReactRouterDOM', 'react-router-dom': 'ReactRouterDOM',
}; };
@ -76,4 +80,7 @@ module.exports = {
return config; return config;
}, },
htmlTemplateExtraData: {
isDev,
},
}; };

View File

@ -110,6 +110,11 @@
</head> </head>
<body> <body>
<div id="react-content"> <div id="react-content">
{% if isDev %}
<script src="https://as.alipayobjects.com/g/component/??react/15.6.1/react.js,react/15.6.1/react-dom.js"></script>
{% else %}
<script src="https://as.alipayobjects.com/g/component/??react/15.6.1/react.min.js,react/15.6.1/react-dom.min.js"></script>
{% endif %}
{{ content | safe }} {{ content | safe }}
</div> </div>
<script src="{{ root }}common.js"></script> <script src="{{ root }}common.js"></script>