hughsk / uglifyify

A browserify transform which minifies your code using UglifyJS2
Other
376 stars 61 forks source link

different output file size #64

Open nickleefly opened 7 years ago

nickleefly commented 7 years ago

Is there anything I'm doing wrong?

The output from below is 343K

browserify -t [ babelify --presets [ es2015 react ] ]  src/index.js \
-g [ envify --NODE_ENV production ] \
-g uglifyify -p bundle-collapser/plugin \
| uglifyjs -cm > public/build/app.js

is smaller than the one below is439K build.js

var browserify = require('browserify')
var envify = require('envify/custom')

browserify('src/index.js')
  .transform('babelify', {presets: ['es2015', 'react']})
  .transform(envify({NODE_ENV: 'production'}))
  .transform({
    global: true,
    mangle: true,
    sourcemap: false,
    compress: {
      sequences: true,
      dead_code: true,
      booleans: true
    }
  }, 'uglifyify')
  .plugin(require('bundle-collapser/plugin'))
  .bundle()
  .pipe(process.stdout)

then node build.js | uglifyjs -cm > public/build/app.js

casr commented 7 years ago

Maybe give https://github.com/hughsk/uglifyify/pull/62 a go?