...
|
...
|
@@ -3,6 +3,24 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin'); |
|
|
const webpack = require('webpack');
|
|
|
const shelljs = require('shelljs');
|
|
|
const _ = require('lodash');
|
|
|
const HappyPack = require('happypack');
|
|
|
const os = require('os');
|
|
|
|
|
|
const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line
|
|
|
size: os.cpus().length
|
|
|
});
|
|
|
|
|
|
const hbsLoader = {
|
|
|
loader: 'handlebars-loader',
|
|
|
options: {
|
|
|
helperDirs: [
|
|
|
path.join(__dirname, '../js/common/helpers')
|
|
|
],
|
|
|
partialDirs: [
|
|
|
path.join(__dirname, '../../doraemon/views/partial')
|
|
|
]
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const getEntries = () => {
|
|
|
const entries = {
|
...
|
...
|
@@ -59,7 +77,7 @@ module.exports = { |
|
|
test: /\.js$/,
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
use: {
|
|
|
loader: 'babel-loader'
|
|
|
loader: 'happypack/loader?id=js'
|
|
|
}
|
|
|
}, {
|
|
|
test: /\.css$/,
|
...
|
...
|
@@ -76,19 +94,21 @@ module.exports = { |
|
|
}, {
|
|
|
test: /\.hbs$/,
|
|
|
use: [{
|
|
|
loader: 'handlebars-loader',
|
|
|
options: {
|
|
|
helperDirs: [
|
|
|
path.join(__dirname, '../js/common/helpers')
|
|
|
],
|
|
|
partialDirs: [
|
|
|
path.join(__dirname, '../../doraemon/views/partial')
|
|
|
]
|
|
|
}
|
|
|
loader: 'happypack/loader?id=hbs'
|
|
|
}]
|
|
|
}]
|
|
|
},
|
|
|
plugins: [
|
|
|
new HappyPack({
|
|
|
id: 'js',
|
|
|
threadPool: happyThreadPool,
|
|
|
loaders: ['babel-loader'],
|
|
|
}),
|
|
|
new HappyPack({
|
|
|
id: 'hbs',
|
|
|
threadPool: happyThreadPool,
|
|
|
loaders: [hbsLoader]
|
|
|
}),
|
|
|
new ExtractTextPlugin('[name].css'),
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
names: 'libs'
|
...
|
...
|
|