AdrieanKhisbe/bundle-phobia-cli

Size of package returns null on install

Closed this issue · 3 comments

When I install a package with a max-overall-size option specified, the package install fails every time because bundle-phobia is seeing the package size as null

For example, given the following in my package.json:

...
"bundle-phobia": {
    "max-size": "20kB",
    "max-overall-size": "50kB"
  },

When I run bundle-phobia-install react, I see:

ℹ Applying a size limit of 20KB from argv and overall size limit of 50KB from argv

✖ Could not install for following reasons:
✔ react: was individually ok to install
✖ global constraint is not respected: overall size after install would be over threshold (0B installed + null > 50KB)
bundle-phobia-install failed: Install was canceled.

From what I can tell, the size does get returned when bundle-phobia fetch's the package (fetchPackageStats), but never gets set for toInstallStats. Adding a console.info(toInstallStats) here results in:

{ size: undefined, gzip: undefined, dependencyCount: undefined }

Thanks @tkadlec for the investigation.
I have the fix incoming in #26, and will publish a patch once merge

@tkadlec You can try bundle-phobia-cli@0.14.6 :)

Worked perfectly! Thanks!