webpack icon indicating copy to clipboard operation
webpack copied to clipboard

Help with Compression

Open yoni-tock opened this issue 11 years ago • 2 comments

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!

yoni-tock avatar Apr 23 '15 17:04 yoni-tock

Having anything for devtool causes compression to be meaningless. Removed it and things are great.

yoni-tock avatar Apr 23 '15 18:04 yoni-tock

mouah, great, omit to remove it too for production...so long time spent on it

darul75 avatar May 11 '15 20:05 darul75