jaydenseric / extract-files

A function to recursively extract files and their object paths within a value, replacing them with null in a deep clone without mutating the original value. FileList instances are treated as File instance arrays. Files are typically File and Blob instances.
https://npm.im/extract-files
MIT License
54 stars 23 forks source link

Reduce bundle size #3

Closed jaydenseric closed 6 years ago

jaydenseric commented 6 years ago

While the source code is tiny, transpilation adds runtime helpers / polyfills.

See https://bundlephobia.com/result?p=extract-files@2.0.1. 17.5 kB minified is crazy for package with only 100 lines, half comments.

The good news is that the extra code is being imported, so if your app or other dependencies use Babel too there is a good chance you are importing the extras already.

These are the extra imports in dist to look at eliminating:

import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _Array$from from 'babel-runtime/core-js/array/from';
import _Object$keys from 'babel-runtime/core-js/object/keys';
import _typeof from 'babel-runtime/helpers/typeof';