Skip to content

Commit 1bcc162

Browse files
author
yunkui.zhou
committed
修改配置语法
1 parent 19467e9 commit 1bcc162

3 files changed

+11
-7
lines changed

webpack/webpack.config.babel.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
const NODE_ENV = process.env.NODE_ENV;
1+
import devConfig from './webpack.config.dev.babel';
2+
import prodConfig from './webpack.config.prod.babel';
3+
4+
const { NODE_ENV } = process.env;
5+
26
let config;
3-
if (NODE_ENV === 'local') {
4-
config = require('./webpack.config.dev.babel');
7+
if (NODE_ENV === 'development') {
8+
console.log('读取webpack.config.dev.babel.js');
9+
config = devConfig;
510
} else {
6-
config = require('./webpack.config.prod.babel');
11+
console.log('读取webpack.config.prod.babel.js');
12+
config = prodConfig;
713
}
814
module.exports = config;

webpack/webpack.config.dev.babel.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ const commonConfig = require('./webpack.config.common.babel');
1010
const publicPath = '/';
1111
const copyEntry = Object.assign({}, commonConfig.entry);
1212
const entry = {};
13-
Object.keys(copyEntry).map((item) => {
13+
Object.keys(copyEntry).forEach((item) => {
1414
const temp = [...copyEntry[item]];
1515
temp.unshift('webpack-hot-middleware/client?path=/__webpack_hmr&timeout=2000&reload=true');
1616
entry[item] = temp;
1717
});
18-
console.log('读取webpack.config.dev.babel.js');
1918
const config = {
2019
mode: 'development',
2120
devtool: 'eval-source-map',

webpack/webpack.config.prod.babel.js

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const ExtractCssChunks = require('extract-text-webpack-plugin');
1111
const publicPath = '/mapping/';
1212
const commonConfig = require('./webpack.config.common.babel');
1313

14-
console.log('读取webpack production');
1514
const config = {
1615
mode: 'production',
1716
devtool: 'source-map',

0 commit comments

Comments
 (0)