This repository was archived by the owner on Dec 5, 2019. It is now read-only.
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
Uglify Does Not Uglify Enough on Latest Webpack + React 16 #206
Closed
Description
Hi,
Thanks for your work on this library. I recently upgraded to the latest version of webpack and react and I'm now seeing the following in my console (in Production).
My webpack config looks kind of like this:
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
var config = {
entry: {
public: APP_DIR + '/public.main.jsx',
private: APP_DIR + '/private.main.jsx',
},
output: {
path: BUILD_DIR,
filename: "[name].bundle.js",
chunkFilename: "[name].bundle.js",
},
plugins: [
new webpack.EnvironmentPlugin(['NODE_ENV']),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'init',
filename: 'init.js',
}),
new UglifyJsPlugin({
uglifyOptions:{
output: {
comments: false, // remove comments
},
compress: {
unused: true,
dead_code: true, // big one--strip code that will never execute
warnings: false, // good for prod apps so users can't peek behind curtain
drop_debugger: true,
conditionals: true,
evaluate: true,
drop_console: true, // strips console statements
sequences: true,
booleans: true,
}
},
}),
new webpack.optimize.AggressiveMergingPlugin()
],
resolve: {
extensions: ['*', '.js', '.jsx'],
modules: [path.resolve(__dirname, 'react_components'), 'node_modules']
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
cacheDirectory: false,
plugins: [
require.resolve('babel-plugin-transform-decorators-legacy'),
],
presets: [
require.resolve('babel-preset-react'),
require.resolve('babel-preset-env'),
require.resolve('babel-preset-stage-0')
]
}
}
]
}
}
module.exports = config;
Thanks,
Michael
Metadata
Metadata
Assignees
Labels
No labels