Building Blaze with webpack

My team and I are in the process of migrating from Meteor-Blaze to Meteor-React, and we’re looking to gain more control over our build process for a few reasons. Namely that there currently isn’t enough configuration options available for typescript as tsconfig is ignored by meteor-typescript, the third party TS builder is agonizingly slow, and we’d like to utilize some sort of tree-shaking as our app bundle is becoming rather large.

Has anybody had any luck building meteor-blaze with web-pack / would it be possible? Ive seen meteor-webpack but it looks like its only able to work with react only, and we still have a large amount of code in blaze.

1 Like

yessir - I wrote a set of npm packages to do just this:

  1. https://www.npmjs.com/package/meteor-blaze-compiler
  2. https://www.npmjs.com/package/meteor-blaze-runtime
1 Like

@znewsham. Nice! Is there an example project somewhere that shows how you use these packages with webpack?

There’s an example here: https://bitbucket.org/znewsham/meteor-blaze/src/master/webpack-project/

1 Like

Coming back to this after a bit, I had tried extensively to get your blaze compiler to work with my complex Meteor/Blaze/React project, but unfortunately got nowhere, i can come back to it in a bit to recall exactly what errors i ran into. But it seems from a first glance that this is just aimed at blaze and not building an entire meteor app, am i correct?

I’m not sure how well it would work when mixed with react, I assumed you would be moving away from meteor to use webpack for everything. You can use this with a meteor project by using the included meteor package, but it is quite hacky. Lots of packages implicitly depend on blaze but don’t list them in their deps, and blaze itself requires several packages to function. Long story short if you’re still using meteor, use the regular meteor blaze package. I’m not even sure how you’d go about building out all the rest of a meteor application with webpack.