Authored by 毕凯

rm happypack

... ... @@ -106,7 +106,6 @@
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"friendly-errors-webpack-plugin": "^1.7.0",
"handlebars-loader": "^1.7.0",
"happypack": "^5.0.0-beta.3",
"husky": "^0.14.3",
"intersection-observer": "^0.5.0",
"jquery-lazyload": "^1.9.7",
... ...
... ... @@ -6,19 +6,13 @@
'use strict';
const os = require('os');
const path = require('path');
const shelljs = require('shelljs');
const _ = require('lodash');
const webpack = require('webpack');
const HappyPack = require('happypack');
const { cssLoader, hbsLoader } = require('./utils.js');
const postcssConfig = require('./postcss.config.js');
const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line
size: os.cpus().length
});
const getEntries = () => {
const entries = {
... ... @@ -83,16 +77,14 @@ module.exports = (env) => {
test: /\.js$/,
exclude: [/node_modules/],
use: [{
loader: 'happypack/loader?id=js'
loader: 'babel-loader'
}]
}, {
test: /\.css$/,
use: cssLoader(env, 'css')
}, {
test: /\.hbs$/,
use: [{
loader: 'happypack/loader?id=hbs'
}]
use: [hbsLoader]
}]
},
resolve: {
... ... @@ -138,21 +130,6 @@ module.exports = (env) => {
maxAssetSize: 512000
},
plugins: [
new HappyPack({
id: 'js',
threadPool: happyThreadPool,
loaders: ['babel-loader'],
}),
new HappyPack({
id: 'hbs',
threadPool: happyThreadPool,
loaders: [hbsLoader]
}),
// new webpack.optimize.CommonsChunkPlugin({
// name: 'libs',
// filename: 'libs.js'
// }),
new webpack.ProvidePlugin({
$: 'yoho-jquery',
jQuery: 'yoho-jquery',
... ...
const webpack = require('webpack');
const path = require('path');
module.exports = {
mode: 'production',
entry: {
sw: path.join(__dirname, '../js/pwa/sw.js')
},
... ... @@ -16,13 +17,5 @@ module.exports = {
include: [path.join(__dirname, '../../node_modules/workbox-sw'), path.join(__dirname, '../js')],
use: 'babel-loader'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin()
]
}
};
... ...