Better error message if file is missing

Author: ivanhoferCreated Apr 23, 2021Updated May 5, 2021

It took me a while to realize what was wrong: the file I tried to test was missing, because I forgot to build my library before I ran npm size-limit.

I got following error message:

✖ Adding to empty webpack project
 ERROR  WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

It would be a nice UX improvements when the error could be catched and a "human-readable" error message would be displayed instead. Something like: "Could not test {{name}} because file '{{path}}' is missing"

used package-versions:

@size-limit/preset-app: ^4.10.2
@size-limit/webpack: 4.10.2
size-limit: 4.10.2