Merge pull request from mzgoddard/webpack-4

Update to webpack 4
This commit is contained in:
Ray Schamp 2018-05-07 11:28:51 -04:00 committed by GitHub
commit a9a23ef589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

View file

@ -35,7 +35,7 @@
"babel-loader": "^7.0.0", "babel-loader": "^7.0.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"canvas-toBlob": "1.0.0", "canvas-toBlob": "1.0.0",
"copy-webpack-plugin": "4.2.1", "copy-webpack-plugin": "^4.5.1",
"decode-html": "2.0.0", "decode-html": "2.0.0",
"escape-html": "1.0.3", "escape-html": "1.0.3",
"eslint": "^4.5.0", "eslint": "^4.5.0",
@ -67,8 +67,9 @@
"tap": "^11.0.1", "tap": "^11.0.1",
"text-encoding": "0.6.4", "text-encoding": "0.6.4",
"tiny-worker": "^2.1.1", "tiny-worker": "^2.1.1",
"webpack": "^3.10.0", "webpack": "^4.8.0",
"webpack-dev-server": "^2.4.1", "webpack-cli": "^2.0.15",
"worker-loader": "1.1.0" "webpack-dev-server": "^3.1.3",
"worker-loader": "^1.1.1"
} }
} }

View file

@ -1,9 +1,10 @@
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const defaultsDeep = require('lodash.defaultsdeep'); const defaultsDeep = require('lodash.defaultsdeep');
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const base = { const base = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
devServer: { devServer: {
contentBase: false, contentBase: false,
host: '0.0.0.0', host: '0.0.0.0',
@ -28,12 +29,14 @@ const base = {
loader: 'file-loader' loader: 'file-loader'
}] }]
}, },
plugins: process.env.NODE_ENV === 'production' ? [ optimization: {
new webpack.optimize.UglifyJsPlugin({ minimizer: [
include: /\.min\.js$/, new UglifyJsPlugin({
minimize: true include: /\.min\.js$/
}) })
] : [] ]
},
plugins: []
}; };
module.exports = [ module.exports = [
@ -129,6 +132,9 @@ module.exports = [
} }
]) ])
}, },
performance: {
hints: false
},
plugins: base.plugins.concat([ plugins: base.plugins.concat([
new CopyWebpackPlugin([{ new CopyWebpackPlugin([{
from: 'node_modules/scratch-blocks/media', from: 'node_modules/scratch-blocks/media',