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

chore: decrease UI build size #43

Merged
merged 11 commits into from Sep 20, 2019
Merged

chore: decrease UI build size #43

merged 11 commits into from Sep 20, 2019

Conversation

e00dan
Copy link
Contributor

@e00dan e00dan commented Sep 18, 2019

Changes:

  • Decrease UI bundle.js size from: 8.37 MB to 3.2 MB
  • Enable GZIP in UI docker-compose (which gets it further down to around 1 MB)
  • Add separate tsconfig.build.shakeable.json files which use es2015 modules, so tree-shaking for tools like webpack is possible (commonjs won't work)
  • Generate ABI-only contract wrappers in user-registry, asset-registry, origin, market
  • Export full contract JSON files separately from other logic

Issues:

Future ideas:

  • We could leverage Node.js 12 experimental modules and this way we possibly wouldn't need commonjs at all

@kosecki123
Copy link
Contributor

So this creates alternative es modules based pipeline which them can enable better UI optimizations.

What if we would switch to es modules by default? Besides UI we have few packages which are executables, we can configure the run so they use esm for instance or we configure bundlers for those projects.

@e00dan
Copy link
Contributor Author

e00dan commented Sep 18, 2019

Trying to switch to es6 gives following scenario, for example, utils-demo (commonjs) depends on market (es6), this results: utils-demo will crash with error: unexpected identifier import.

Utils-demo would have to compile differently modules it depends on, which, would also create 2 alternative build pipelines.

Ts-node or ts compiler in utils-demo doesn't compile dependencies, so import keywords in dependencies stay as they are, and when utils-demo try to use that dependencies JS code, there's a crash.

Switching to es modules where most of our packages are meant to run by node.js could make the pipeline more complicated, because it basically means that we break compatibility with it, unless we would be on higher version of node.js, which I believe is impossible because of our web3 dependency.

That said, I'm keen to experiment more and will keep thinking on how to improve our flow.

@josipbagaric josipbagaric marked this pull request as ready for review September 20, 2019 10:07
@e00dan e00dan merged commit 11b7971 into master Sep 20, 2019
@e00dan e00dan deleted the chore/decrease-build-size branch September 20, 2019 10:32
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.

None yet

3 participants