...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
const os = require('os');
|
|
|
const path = require('path');
|
|
|
const shelljs = require('shelljs');
|
|
|
const _ = require('lodash');
|
|
|
const webpack = require('webpack');
|
|
|
const HappyPack = require('happypack');
|
|
|
const UglifyJsParallelPlugin = require('webpack-uglify-parallel');
|
...
|
...
|
@@ -21,32 +22,41 @@ shelljs.cp('-R', path.join(__dirname, '../img/'), distDir); |
|
|
shelljs.cp('-R', path.join(__dirname, '../font/'), distDir);
|
|
|
|
|
|
baseConfig = baseConfig('pro');
|
|
|
baseConfig.output.path = distDir;
|
|
|
baseConfig.plugins.push(
|
|
|
new ExtractTextPlugin('[name].css'),
|
|
|
new HappyPack({
|
|
|
id: 'js',
|
|
|
threadPool: happyThreadPool,
|
|
|
loaders: ['babel-loader'],
|
|
|
}),
|
|
|
new HappyPack({
|
|
|
id: 'hbs',
|
|
|
threadPool: happyThreadPool,
|
|
|
loaders: [baseConfig.extends.hbsLoader]
|
|
|
}),
|
|
|
new webpack.DefinePlugin({
|
|
|
'process.env': {
|
|
|
NODE_ENV: '"production"'
|
|
|
}
|
|
|
}),
|
|
|
new UglifyJsParallelPlugin({
|
|
|
workers: os.cpus().length,
|
|
|
compress: {
|
|
|
warnings: false
|
|
|
},
|
|
|
comments: false
|
|
|
})
|
|
|
);
|
|
|
|
|
|
_.mergeWith(baseConfig, {
|
|
|
output: {
|
|
|
path: distDir
|
|
|
},
|
|
|
plugins: [
|
|
|
new ExtractTextPlugin('[name].css'),
|
|
|
new HappyPack({
|
|
|
id: 'js',
|
|
|
threadPool: happyThreadPool,
|
|
|
loaders: ['babel-loader'],
|
|
|
}),
|
|
|
new HappyPack({
|
|
|
id: 'hbs',
|
|
|
threadPool: happyThreadPool,
|
|
|
loaders: [baseConfig.extends.hbsLoader]
|
|
|
}),
|
|
|
new webpack.DefinePlugin({
|
|
|
'process.env': {
|
|
|
NODE_ENV: '"production"'
|
|
|
}
|
|
|
}),
|
|
|
new UglifyJsParallelPlugin({
|
|
|
workers: os.cpus().length,
|
|
|
compress: {
|
|
|
warnings: false
|
|
|
},
|
|
|
comments: false
|
|
|
})
|
|
|
]
|
|
|
}, function customizer(objValue, srcValue) {
|
|
|
if (_.isArray(objValue)) {
|
|
|
return objValue.concat(srcValue);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
delete baseConfig.extends;
|
|
|
|
...
|
...
|
|