javascript - Webpack does not compress the files enough -


this webpack config use development , production modes;

let debug = process.env.node_env !== 'production'; import webpack "webpack"; import livereloadplugin "webpack-livereload-plugin"; import webpacknotifierplugin "webpack-notifier"; import validate "webpack-validator"; import failplugin "webpack-fail-plugin"; import autoprefixer "autoprefixer";  let loaders = [     {test: /\.tsx?$/, loader: 'ts', exclude: /(node_modules)/},     {         test   : /\.js?$/,         exclude: /(node_modules)/,         loader : 'babel', // 'babel-loader' legal name reference         query  : {             presets       : ['es2015'],             cachedirectory: true         }     },     {         test  : /\.(eot|ttf|wav|mp3|png|jpg|jpeg|gif|svg|woff|woff2)$/,         loader: 'url-loader',     },     {         test   : /\.scss$/,         loaders: [             "style-loader",             "css-loader",             "postcss-loader",             "sass-loader?outputstyle=compressed"         ]     } ];  let globaljquery = {     $              : 'jquery',     jquery         : 'jquery',     'window.jquery': 'jquery' };   let devplugins = [     new webpacknotifierplugin({excludewarnings: true}),     new webpack.provideplugin(globaljquery),     new livereloadplugin(),     new webpack.defineplugin({         'process.env': {             'node_env': json.stringify('production')         }     }),     // new extracttextplugin('css/app.css', {allchunks: true}),     failplugin, ];  let prodplugins = [     new webpack.optimize.dedupeplugin(),     new webpack.optimize.occurenceorderplugin(),     new webpack.optimize.uglifyjsplugin({         compress : {warnings: false},         output   : {comments: false},         sourcemap: false     }),     new webpack.provideplugin(globaljquery) ];  module.exports = validate({     context: __dirname,     devtool: 'eval',     resolve: {         extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'],         alias     : {jquery: __dirname + '/resources/assets/js/libs/jquery-3.1.0.min.js'}     },     entry  : [         // 'webpack/hot/dev-server',         // 'webpack-dev-server/client?http://localhost:8081',         __dirname + '/resources/assets/js/main.js'     ],     output : {         path      : __dirname + '/public',         publicpath: '/public/',         filename  : 'js/app.js'     },     plugins: debug ? devplugins : prodplugins,     module : {         loaders: loaders,     },     postcss: () => {         return [autoprefixer]     } }); 

but reason if minify modules individually compiles smaller bundle if delegate same task webpack in production mode.

for example if use uncompressed "owl carousel" plugin , delegate compressing task webpack bundle 43 kb larger.

plugins such photoswipe make bundle around 82kb larger.

jquery 120kb larger...

what miss compressing individual plugins manually more efficient, point of view webpack should doing task automatically , compressing files same level doing manually...?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -