webpack
webpack copied to clipboard
Help with Compression
Hey there,
I'm working on a project using react, webpack, and marty. I just switched from browserify to webpack because webpack is doing a better job of picking up jsx changes, but now I can't seem to get my compiled javascript to compress at all. Using the uglify plugin I still end up with a project that's exactly the same (huge) size.
Here's my webpack config file:
var path = require("path");
var webpack = require("webpack");
module.exports = {
cache: false,
debug: true,
stats: {
colors: true,
reasons: true,
},
devtool: '#eval-cheap-module-source-map',
entry: {
index: path.join(__dirname, "/src/js/index.jsx")
},
output: {
path: path.join(__dirname, "dist/js"),
publicPath: "/js/",
filename: "[name].js",
},
module: {
loaders: [
// required for react jsx
{ test: /\.js$/, loader: "jsx-loader" },
{ test: /\.jsx$/, loader: "jsx-loader?insertPragma=React.DOM" },
]
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'App': path.join(process.cwd(), './src/js/App'),
'actions': path.join(process.cwd(), './src/js/actions'),
'components': path.join(process.cwd(), './src/js/components'),
'constants': path.join(process.cwd(), './src/js/constants'),
'stores': path.join(process.cwd(), './src/js/stores'),
}
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin()
],
};
All the tweaking I do seems to result in no difference. Any help is appreciated!
Having anything for devtool causes compression to be meaningless. Removed it and things are great.
mouah, great, omit to remove it too for production...so long time spent on it