feat(Webpack): Update to latest

This commit is contained in:
Berkeley Martinez
2018-01-08 20:09:54 -08:00
parent c372bd3cc5
commit e384f6a90c
3 changed files with 1185 additions and 457 deletions

1557
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -139,14 +139,14 @@
"adler32": "~0.1.7",
"babel-cli": "^6.3.17",
"babel-istanbul": "^0.12.1",
"babel-loader": "^6.2.1",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-imports": "^1.4.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-stage-0": "^6.3.13",
"browser-sync": "^2.9.12",
"chunk-manifest-webpack-plugin": "0.1.0",
"chunk-manifest-webpack-plugin": "^1.1.2",
"commitizen": "^2.9.6",
"cz-freecodecamp": "^1.0.1",
"del": "^2.2.0",
@ -185,11 +185,11 @@
"tap-spec": "^4.1.1",
"tape": "^4.2.2",
"validate-commit-msg": "^2.12.2",
"webpack": "^1.9.12",
"webpack-dev-middleware": "^1.8.3",
"webpack-hot-middleware": "^2.12.2",
"webpack-manifest-plugin": "^1.0.0",
"webpack-stream": "^3.1.0",
"webpack": "^3.10.0",
"webpack-dev-middleware": "^2.0.4",
"webpack-hot-middleware": "^2.21.0",
"webpack-manifest-plugin": "^1.3.2",
"webpack-stream": "^4.0.0",
"webpack-visualizer-plugin": "^0.1.11",
"yargs": "^7.0.1"
},

View File

@ -19,30 +19,31 @@ module.exports = {
net: 'empty'
},
output: {
filename: __DEV__ ? 'bundle.js' : 'bundle-[hash].js',
filename: __DEV__ ? '[name].js' : '[name]-[hash].js',
chunkFilename: __DEV__ ?
'bundle-[name].js' :
'bundle-[name]-[chunkhash].js',
'[name].js' :
'[name]-[chunkhash].js',
path: path.join(__dirname, '/public/js'),
publicPath: '/js'
},
resolve: {
alias: {
'dist/rx.all.js': 'rx/dist/rx.all.js'
}
},
module: {
loaders: [
{
rules: [{
test: /\.jsx?$/,
include: [
path.join(__dirname, 'client/'),
path.join(__dirname, 'common/')
path.join(__dirname, 'common/'),
path.join(__dirname, 'server/')
],
loaders: __DEV__ ? ['react-hot', 'babel'] : [ 'babel' ]
},
{
test: /\.json$/,
loaders: [
'json-loader'
]
}
]
use: [
__DEV__ && 'react-hot-loader',
'babel-loader'
].filter(Boolean)
}]
},
externals: {
codemirror: 'CodeMirror',
@ -59,11 +60,7 @@ module.exports = {
new webpack.NormalModuleReplacementPlugin(
/debug\/node/,
'debug/src/browser'
),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(true),
// this will output a .html file in output.path
new Visualizer({ filename: 'webpack-bundle-stats.html' })
)
]
};
@ -78,6 +75,8 @@ if (!__DEV__) {
} else {
module.exports.plugins.push(
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
new webpack.NoErrorsPlugin(),
// this will output a .html file in output.path
new Visualizer({ filename: 'webpack-bundle-stats.html' })
);
}