Reaction: Production js bundle size

Created on 22 Mar 2017  路  10Comments  路  Source: reactioncommerce/reaction

A build of the fresh master checkout with all the default plugins config results in a bundle that is around 4.9MB. Our own fork of RC (with a few custom plugins) is around 5.2MB.

Do you have any ideas/recommendations on how one might go about reducing the size of the bundle since 4MB+ seems like a lot of js, especially for non-admin users where a lot of admin functionality is not even required.

Thanks and keep up good work 馃憤

Most helpful comment

@aldeed can we close this without a more specific issue? this isn't really very actionable.. more a general goal of the performance sprints...

All 10 comments

That is specifically the focus of Meteor 1.5 (the next release). The solution is dynamic imports. So modules are broken up and you don't download them until they've been imported. The most typical use case would likely be route based imports. So anything that lives on the dashboard could be imported separately by the few people that can actually access the dashboard.

Checkout the overview/demo from MDG...

https://youtu.be/zXTvHFghHSc?t=4m27s

Also see some more detailed usage options...

http://2ality.com/2017/01/import-operator.html

@jshimko do you guys have an idea when this might land in RC?

You can already try the beta releases right now...

https://github.com/meteor/meteor/releases

meteor update --release 1.5-beta.12

And I'd keep an eye on the 1.5 release PR

https://github.com/meteor/meteor/pull/8327

That said, you now know as much as we do. :)

Cool. Thanks Jeremy

Hey I've worked up one possible solution. It's where I move almost everything from client into imports and load an initial router, then dynamically import the reaction files needed to login and load the rest on login. I love to help in you haven't already starting working on it. If you want to check out the working example pm me, I've got the bundle down to almost 1 Mb.

@hikingit I think I speak for everybody when I say we would love to see it. Is there any way you can open a PR and we can start discussion/testing there?

@hikingit Any update? We will be making changes similar to what you said, and it would be great if you could post your code/branch as a starting point.

@aldeed Sorry I haven't posted an update, but I've been a little busy. I will work on that today. The thing is I have it mixed with my project so I have to separate the code.

Assigned this to myself to review @hikingit's repo and write more specific issues based on that

@aldeed can we close this without a more specific issue? this isn't really very actionable.. more a general goal of the performance sprints...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zikeji picture zikeji  路  4Comments

ajporlante picture ajporlante  路  4Comments

janus-reith picture janus-reith  路  4Comments

aldeed picture aldeed  路  4Comments

spencern picture spencern  路  3Comments