bundlesize
bundlesize copied to clipboard
Make brotli-size optional by styfle
Description
- Remove
brotli-size
fromdependencies
- Add try-catch around
require('brotli-size')
- Warn if using brotli option but missing
brotli-size
Motivation and Context
It turns out the brotli-size
(#194) is quite big and doesn't install very nicely on Windows.
See the following issues:
Fixes #202 Fixes #213
Eventually, we might even get brotli support in Node Core. See https://github.com/nodejs/node/pull/20458
@siddharthkp: I currently have downgraded bundlesize to 0.15. This should be squashed and merged ASAP.
Node.js 10.0.0 is out for quite some time.
@styfle Do you think the build should error out instead of passing if brotli-size
is not installed?
(Check out the result of the build)
I have added you as a collaborator so you can commit directly to this branch (instead of a fork)
@siddharthkp That's a good point since they specifically said they wanted to use brotli. Maybe the correct thing to do is fail fast and just throw instead of a warning:
throw new Error('Missing optional dependency. Install it with: npm install --save brotli-size')
Thoughts?
I agree with you guys Requesting to check the size based on brotli compression and getting an OK return code seems wrong
@siddharthkp Ok the build is failing as expected now that there is a throw.
How should we fix the tests so that brotli-size is installed? Add to devDependencies?
how about running it once and checking for failure and then running npm i brotli-size
and running again and check for success?
@eseliger That was my first thought but I don't see a test harness so I'm not sure how to assert that and error was thrown with the current test commands.
hmm maybe some script like this will work
bundlezise
if [ $? -eq 0 ]
then
echo "Should have failed"
exit 1
else
exit 0
fi
Hey, guys. Any news? I'm still using a downgraded version due to no node.js 10.x support.
I think @siddharthkp still wanted to make a change here.
Another related issue worth pursuing is to get brotli support in Node Core. Put a 👍 on this issue: https://github.com/nodejs/node/issues/18964
@siddharthkp: friendly ping!
Is the package abandoned @siddharthkp ?
FYI, brotli support landed in Node core and should be in the next release.