...
|
...
|
@@ -5,17 +5,12 @@ 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');
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
const config = require('../../package.json');
|
|
|
const distDir = path.join(__dirname, `../dist/${config.name}/${config.version}`);
|
|
|
let baseConfig = require('./webpack.base.config.js');
|
|
|
|
|
|
const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line
|
|
|
size: os.cpus().length
|
|
|
});
|
|
|
|
|
|
// cope img font
|
|
|
shelljs.mkdir('-p', distDir);
|
|
|
shelljs.cp('-R', path.join(__dirname, '../img/'), distDir);
|
...
|
...
|
@@ -29,21 +24,16 @@ _.mergeWith(baseConfig, { |
|
|
},
|
|
|
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 webpack.optimize.UglifyJsPlugin({
|
|
|
compress: {
|
|
|
warnings: false
|
|
|
}
|
|
|
}),
|
|
|
new UglifyJsParallelPlugin({
|
|
|
workers: os.cpus().length,
|
|
|
compress: {
|
...
|
...
|
@@ -58,6 +48,4 @@ _.mergeWith(baseConfig, { |
|
|
}
|
|
|
});
|
|
|
|
|
|
delete baseConfig.extends;
|
|
|
|
|
|
module.exports = baseConfig; |
...
|
...
|
|