Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce size of filer.js #575

Open
humphd opened this issue Nov 27, 2018 · 2 comments
Open

Reduce size of filer.js #575

humphd opened this issue Nov 27, 2018 · 2 comments

Comments

@humphd
Copy link
Contributor

humphd commented Nov 27, 2018

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)
@humphd
Copy link
Contributor Author

humphd commented Dec 2, 2018

#597 to switch away from our internal src/path.js

@humphd
Copy link
Contributor Author

humphd commented Dec 2, 2018

#598 to switch from minimatch to picomatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant