Webpacker: Support for minifying / compressing webpacker:compile output

Created on 1 Jul 2017  路  9Comments  路  Source: rails/webpacker

Currently the packs produced by webpacker:compile are unminified, uncompressed files. The normal asset pipeline files get minified and gzip'd. Are there plans to support this functionality for webpacker? Thanks.

Most helpful comment

NODE_ENV=production bundle exec rails/rake webpacker:compile - that should compile production ready assets

All 9 comments

They are minified and compressed when compiled in the production environment, unless you changed the default configuration: https://github.com/rails/webpacker/blob/master/lib/install/config/webpack/production.js

NODE_ENV=production bundle exec rails/rake webpacker:compile - that should compile production ready assets

when I try Chrome Audit tool, it says JS can use more minifying.

screen shot 2018-08-20 at 2 46 41 pm

Can you provide the URL of a sample file? Did you build it with the production config?

https://www.coursemate.io/packs/application-d7b96eefba522259c780.js

Yes, NODE_ENV is set to production in my environment variables.

@renchap any luck?

The file looks minified. I am not sure how Lighthouse calculated the gains you can have. After running your file through uglify 2, I get a 9% reduction, but I guess this is because you are not using the latest Uglify version.
I really think this is a Lighthouse problem here.

On another application, I installed PageSpeed module, and lighthouse got happy and no complains. I will dig into this and report my findings later.

Was this page helpful?
0 / 5 - 0 ratings