Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reduce size of filer.js #575

@humphd

Description

@humphd
parcel build --global Filer src/index.js --out-file filer.min.js --detailed-report

✨  Built in 263ms.

dist/filer.min.js                            89.26 KB    155ms
├── src/filesystem/implementation.js         20.39 KB     10ms
├── node_modules/buffer/index.js             19.54 KB     11ms
├── node_modules/minimatch/minimatch.js       7.32 KB     11ms
├── src/shell/shell.js                        3.88 KB      4ms
├── lib/intercom.js                           3.76 KB      8ms
├── src/filesystem/interface.js               3.39 KB      3ms
├── src/providers/websql.js                   2.47 KB      3ms
├── lib/nodash.js                             2.35 KB      8ms
├── src/providers/indexeddb.js                2.17 KB      4ms
├── node_modules/path-browserify/index.js      2.1 KB      2ms
└── + 27 more assets

We're currently sitting at ~89K for our minified version. That's a lot. Looking at the bundle info above, a few things we could do here:

  1. Pull the Shell out into a separate file (3K + 7K = 10K). You don't always need it, so let's not always bundle it
  2. Reduce the size of implementation.js by moving to async/await and throwing away most of the callback code. We have tones of code that is just functions wrapped around checks err callbacks. If we used async/await instead, we'd just await in a try...catch.
  3. Make WebSQL an optional provider, bundle it separately #569 to pull WebSQL out into a separate file (2K)
  4. Replace lib/nodash.js with ES6 array methods #572 to remove nodash.js (2K)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions