Webpacker: Outputting .br files in production even when not using Brotli

Created on 16 Dec 2019  路  3Comments  路  Source: rails/webpacker

after the support was added for Brotli in 4.1.0, I noticed our prod build started emitting both .gz and .br without anything changing in our setup or configs except updating Webpacker.

Rolling back to 4.0.7 predictably solves the issue.

Is there some way to explicitly disable this output?

Most helpful comment

you can do it before toWebpackConfig

environment.plugins.delete('Compression Brotli')

but I'd really wanna see plugins section be more configurable through webpacker.yml maybe

All 3 comments

Also wondering if there's a way to disable this

@JoshRobertson @njradford this works, but I'd love to see a more accesible config option exposed to disable brotli.

// in production.js
const config = environment.toWebpackConfig();
// Disables brotli (.br) compression
config.plugins = config.plugins.filter(conf => {
  if (conf.options) {
    return conf.options.filename !== "[path].br[query]";
  } else {
    return conf;
  }
});

you can do it before toWebpackConfig

environment.plugins.delete('Compression Brotli')

but I'd really wanna see plugins section be more configurable through webpacker.yml maybe

Was this page helpful?
0 / 5 - 0 ratings