frictionless-js icon indicating copy to clipboard operation
frictionless-js copied to clipboard

NPM package size is huge

Open anuveyatsu opened this issue 5 years ago • 8 comments

The package increases bundle size significantly, please, check: https://bundlephobia.com/[email protected]

image

anuveyatsu avatar Jul 05 '19 06:07 anuveyatsu

nearly 50% is xlsx which is not even essential IMO. I wonder if all "readers" other than CSV should be outside of core and only built optionally (we could do 2 builds: a full build and a lean build).

Also why do we need moment? (and is iconv-lite necessary?)

rufuspollock avatar Jul 05 '19 07:07 rufuspollock

@rufuspollock this is one of the reasons for data explorer's size. cc/ @starsinmypockets

anuveyatsu avatar Sep 03 '19 04:09 anuveyatsu

  • Removing xls seems like a no-brainer
  • I like the idea of having pluggable or configurable builds
  • dayjs replaces moment, is 2kb and has 23k ⭐️ (i've never used it)

starsinmypockets avatar Sep 03 '19 10:09 starsinmypockets

@starsinmypockets can you have a look at this and estimate.

I also think iconv-lite is not need most of the time.

rufuspollock avatar Sep 03 '19 16:09 rufuspollock

@rufuspollock

I would estimate:

  • 2 hrs to strip xls (or see lazy-loading below)
  • 2 hrs to replace moment
  • .5 - 1d implement a lazy-loading scheme (load if needed only -- I think there's some risk here / need further analysis)
  • stripping iconv-lite we should wait on it -- we use it to decode non-utf8 encoded csv's -- a robust solution here will probably save us all loads of hair-pulling and is worth the weight. Should be able to lazy-load it also as per lazy-loading scheme (tbd)

starsinmypockets avatar Sep 03 '19 17:09 starsinmypockets

OK, i think we should think about this in the bigger picture of data explorer first.

rufuspollock avatar Sep 03 '19 17:09 rufuspollock

xlsx seems huge as it has both reader and writer for xlsx/xls. I guess we need only xlsx/xls reader so we could replace it with, e.g., xlsx-extractor which is 4x smaller (163kb vs 646kb).

anuveyatsu avatar Sep 17 '19 04:09 anuveyatsu

@starsinmypockets I think implementing lazy loading would make sense in data explorer but not in data.js.

anuveyatsu avatar Sep 17 '19 04:09 anuveyatsu