egoist / package-size

Get the bundle size of an npm package.
MIT License
425 stars 26 forks source link

Support for missing dependencies #6

Closed drcmda closed 7 years ago

drcmda commented 7 years ago

This module is awesome, but it kept crashing on some libs i've tried, usually Module not found: Error: Can't resolve '...'


❯ package-size preact-compat       

  package        size  minified  minified+gzipped
  preact-compat  ...   ...       ...

 ERROR  Compiled with errors!

Error: 
ERROR in /private/var/folders/n6/2ys_sbln60d7hlwngzqzs_p80000gn/T/package-size-lwt529m5lmpylqjbutyb9/~/preact-compat/dist/preact-compat.es.js
Module not found: Error: Can't resolve 'preact' in '/private/var/folders/n6/2ys_sbln60d7hlwngzqzs_p80000gn/T/package-size-lwt529m5lmpylqjbutyb9/node_modules/preact-compat/dist'
 @ /private/var/folders/n6/2ys_sbln60d7hlwngzqzs_p80000gn/T/package-size-lwt529m5lmpylqjbutyb9/~/preact-compat/dist/preact-compat.es.js 2:0-69
 @ multi preact-compat
    at /usr/local/lib/node_modules/package-size/lib/index.js:114:11
    at Generator.next (<anonymous>)
    at onFulfilled (/usr/local/lib/node_modules/package-size/node_modules/co/index.js:65:19)
egoist commented 7 years ago

Hmm, it sounds good to check if the package has peerDependencies first, but for now you can either use package-size preact-compat,preact to get full size or package-size preact-compat --externals preact to get size of preact-compat only

egoist commented 7 years ago
2017-04-05 6 25 41

It works fine now, peerDependencies are automatically excluded.