Skip to content

Better bundling#25

Open
sunify wants to merge 5 commits into
austintgriffith:masterfrom
leapdao:upstream-bundling
Open

Better bundling#25
sunify wants to merge 5 commits into
austintgriffith:masterfrom
leapdao:upstream-bundling

Conversation

@sunify

@sunify sunify commented May 24, 2019

Copy link
Copy Markdown

These changes will reduce the size of apps drastically (-463.82 KB gzipped for burner-wallet).
Also, it will improve bundling performance

All commits have detailed description and reasoning. Some stuff questionable, e.g. ethereum-ens part, i understand that and will be happy to discuss it.

sunify added 5 commits May 22, 2019 19:47
Since many app will have web3 as a dependency anyway, there is a big chance that web3 will be double bundled. That's the case with burner-wallet for example

So will be much better to not include web3 into bundle (like react and react-dom)
Library shouldn't take care about polyfills for old browsers, apps should do that
Imagine if any libary would do this, it will be a huge mess of unnecessary code
- Do not bundle node_modules. It makes bundling the app much harder.
People could want to ignore some packages or smth like that. It's like to bundle all moment.js locales into moment.js itself

- Create a separate bundles for each exported component
It will allow people to import only one component (since tree shaking is not working) and do not drag entire library with all dependencies and polyfills
ethereum-ens package with all deps weights about 300 KB gzipped.
It's the biggest dependency here and used for really minor thing
No need for http library here, fetch can handle it easily and we'll have -1 dep
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

Successfully merging this pull request may close these issues.

1 participant