bundlesize icon indicating copy to clipboard operation
bundlesize copied to clipboard

bundlesize is 10x larger after npm install since v0.14.0

Open styfle opened this issue 6 years ago • 4 comments

Do you want to request a feature or report a bug? bug

What is the current behavior? npm install --save-dev bundlesize has grown 10x larger than in 0.14.4

If the current behavior is a bug, please provide the steps to reproduce.

Compare the following versions after npm install:

Reproduce with the following script:

mkdir old
cd old
npm init -y
npm install --save-dev [email protected]
cd ..
mkdir new
cd new
npm init -y
npm install --save-dev [email protected]
cd ..
du -sh old # 2.6M
du -sh new # 39M

What is the expected behavior?

I expected the size to be similar and small, around 1 to 3 MB.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information.

  • node version 9.5.0
  • npm version 5.6.0
  • Operating system Windows or Linux
  • bundlesize version 0.17.0
  • CI you are using none

styfle avatar Apr 13 '18 17:04 styfle

Related: #202

edmorley avatar Apr 13 '18 18:04 edmorley

@styfle Do you want to tackle this?

This is because of the addition of brotli-size (https://github.com/siddharthkp/bundlesize/pull/194), we can make this an optional dependency with a warning if it's used before installation.

siddharthkp avatar Apr 13 '18 18:04 siddharthkp

@siddharthkp Let me make sure I understand your proposal.

  1. Move "brotli-size": "0.0.1" from dependencies to optionalDependencies
  2. Put a try-catch around require('brotli-size') and move it inside case 'brotli':
    • in the catch, console.warn('Missing optional dependency: brotli-size')

Does that sound right? I can submit a PR if that seems correct.

styfle avatar Apr 13 '18 19:04 styfle

Sounds perfect!

I'm assuming you are requiring brotli-size only when the config/cli flag says so

siddharthkp avatar Apr 13 '18 19:04 siddharthkp