Meteor + Prepack

Is Prepack ( going to be integrated into Meteor core, to speed things a little bit?? Prepack - A tool for making JavaScript code run faster. Prepack was open sourced by Facebook a few days ago at


Hmm, interesting. So could I just take the minified .js blob that Meteor puts out, and run it through Prepack, and it’ll improve performance somewhat?

1 Like

This will improve performance even further. According to the docs:
Prepack is a tool that optimizes JavaScript source code: Computations that can be done at compile-time instead of run-time get eliminated. Prepack replaces the global code of a JavaScript bundle with equivalent code that is a simple sequence of assignments. This gets rid of most intermediate computations and object allocations.

1 Like

I think @sashko should look into this. Maybe integration with Meteor core…

I haven’t tried doing that yet. That could work. @abernix or @sashko could look into this.

Oh, that looks very interesting, the examples on their website are really cool! I suspect the end result might be less than the examples show though, as V8 is pretty smart and probably already does a lot of these optimizations at runtime. However, doing them at compile time would be better of course, and there might be some stuff that V8 doesn’t do.


You’re right! V8 is smart already. Facebook takes things further in their implementations of ‘popular’ tools. Though Prepack isn’t ready for production use right now, it has several plugins already for VScode, Webpack that I want to try out on Meteor to see what performance gains it actually brings to my existing apps.

1 Like

Hmm, I tried running it on my client blob.
First it gave the error __meteor_runtime_config__ is not defined
I fixed that by copying the __meteor_runtime_config__ inline script that is in the HTML of my site and pasting it at the top.
Now it gives this cryptic error instead:

not an object
    at client.js:4:5255
    at call (native)
    at client.js:4:4727
    at client.js:4:2

Does anyone have actual benchmarks of anything yet?

You’re running into this:

We made need to wait for this:

If you come up with a solution in the meantime, let me know :slight_smile:

1 Like

But I thought it said “using environment browser” or something when it ran. Will check again…

According to the section The Environment matters! of,

Prepack has no built-in knowledge of document or window. In fact, when prepacking code which references such properties, they will evaluate to undefined.


But it says here that it uses the “browser” built-in environment by default. I also now tried with --compatibility “browser”, and it gave me the same error :confused:

Edit: Ah, I checked at 4:5255 now, and it’s this function:


So it is indeed document that is causing trouble, even though they seem to say in the options spec that they’ve fixed that :confused:

Would be nice if there was some way to just say “ignore optimizing anything that references this object”.

When is Prepack ready to be used in production?

Wait for our latest release to reach v1.0.

I think it’s not ready for integration but I’m curious what performance benefits we can get from using it in a real life application.


@mitar You think this could make blaze great again without turning to virtual dom?

Prepack is gonna be in alpha for a while, definitely not ready for production, unfortunately. Currently, it’s only at v0.2.2.

Perhaps we could put together an Atmosphere package (yes, those still exist) integrating it into the Meteor build process, to at least have people start playing around with it in development.