Alex Craft
Alex Craft

Reputation: 15416

Web apps built with meteor have huge JS size?

I checked one of application built with the Meteor web framework http://demo2.telescopeapp.org it loaded huge JS file, about 2.6Mb (minified, unzipped).

I also created an empty app, and it also loaded about 1.2Mb JS (non-minified, unzipped).

Is there a way to make client side JS for Meteor Apps small? Let's say less than 500kb?

Upvotes: 1

Views: 1244

Answers (1)

David Weldon
David Weldon

Reputation: 64342

With meteor 1.1.0.3, the default app's bundled js weighs in at 329k. It's pretty substantial without adding anything yourself. A few things to keep in mind:

  • Meteor doesn't ship HTML - it's rendered via js.
  • Meteor's intent is to pay an up-font cost to load the application, but not have to go back to the server after it's running.
  • Version 1.2 will allow you to separate meteor-platform into some of it's component parts, so you could include fewer parts of meteor by default (e.g. if you didn't want to ship with jquery or mongodb).

So the answer to your question is a pretty straightforward - in order to reduce your code size you need to include fewer packages and write less code.

It's worth mentioning that meteor currently doesn't have a way to selectively load a portion of your app (it's on the roadmap for a future release). For some apps, you can reduce your overall size by separating it into smaller portions and serving them on different subdomains. The canonical example is separating the user and admin portions, rather than bundling them together.

Upvotes: 3

Related Questions