size-limit icon indicating copy to clipboard operation
size-limit copied to clipboard

--why and custom webpack config

Open ai opened this issue 7 years ago • 10 comments
trafficstars

We need a docs with Webpack Bundle Analyzer or hack in index.js to add plugin automatically.

ai avatar Jun 01 '18 19:06 ai

Wondering if this is the same issue:

When we create a custom config, --why appears to be ignored.

bcullman avatar Jun 29 '19 00:06 bcullman

Yeap, we do not have good UI explain that we do not support --why for custom configs.

Just use Webpack Bundle Analyzer manually.

ai avatar Jun 29 '19 00:06 ai

ok, then one question:

When I configure bundle analyzer manually, size-limit switches from reporting package as the gzipped value to the parsed sized value.

How can I get size-limit to report the gzipped value when using a custom Webpack Bundle Analyzer config?

bcullman avatar Jun 29 '19 01:06 bcullman

You need two configs. One you will use to build app and in Size Limit. The second will use Webpack Bundle Analyzer.

ai avatar Jun 29 '19 09:06 ai

The problem i am having is that size limit fails if my build include sass files. So I need a custom config for size limit. I believe I want to set...

[
  {
    config: "path/to/my/config/webpack.config.sizeLimit.js",
    gzip: true
  }
]

...but it is not honoring this value.

when I dont specify a config, the reported size in the console was the gzip size (around 45K) when i specify a config, the reported size in the console switches to the parsed size around (around 550K)

I can see in bundle analyzer both have been computed (and are correct). I just want size-limit to continue to report in the console the gzip size.

bcullman avatar Jun 29 '19 19:06 bcullman

I have a better option for you. If you have big webpck application it will be better to use webpack: false and just call Size Limit after webpack built bundles:

https://github.com/ai/size-limit#usage-for-applications-and-big-libraries

ai avatar Jul 01 '19 23:07 ai

Is there any chance to support --why on create-react-app?

FezVrasta avatar Aug 16 '19 12:08 FezVrasta

You can try manually add Webpack Bundle Analyzer to CRA

ai avatar Aug 16 '19 18:08 ai

Not really. You can't edit CRA config

FezVrasta avatar Aug 16 '19 20:08 FezVrasta

Sorry. Seems like CRA is not the best thing. It will help if we will force CRA to more to sharec (when it will be stabilized) to be able to change configs.

ai avatar Aug 16 '19 21:08 ai