[deepDive]Cutting out all meteor packages: Can you really get rid of Blaze & jquery?


I’m trying to see how to make a meteor app smaller, I’ve noticed that even without any package installed meteor still packs 150kB, this is because meteor requires at least the webapp package to function, which adds Blaze, jQuery & Spacebars, amongst others. I wonder if anyone has dug deeper into meteor-base, respectively the packages within webapp (which is one of the packages included in meteor-base)?

The webapp package is causing the huge file bloat for meteor apps it seems, most likely largely because of the packages mentioned above. Has anyone played around with this and knows which packages of webapp are really essential to run a meteor app (excluding Meteor specific things such as methods).?


Do you know that the two are related? Because WebApp only includes Blaze on the server.


It is possible to remove webapp as well. In this case you have to declare your own “global.main()” function. I have recently passed this exercise for the command line tool, which preloads the Meteor app’s database with data. However I quickly realized that the only Meteor dependency I need is mongo, which requires ddp, which requires webapp. So my next logical step was to replace Meteor’s mongo with mongoose and to completely remove Meteor from the project.

@sashko, could you advice what is the reason to use blaze on the server side as webapp dependency? Are there any near plans to remove jquery as the required dependency?


Why does it matter what webapp depends on on the server side?


I don’t see Webapp depend to Blaze:


boilerplate-generator uses Blaze to generate the server-side HTML.


Just curious :slight_smile: Anyway, smaller footprint is always better.


I suppose someone could make a PR to remove the blaze dep from boilerplate generator. Maybe we could just use handlebars from NPM or something.


People here were saying boilerplate-generator is not bringing jquery in on the client. Maybe the two discussions should merge? I’d love to see the jquery dependency on the client removed - it’s like 15% of my client bundle in one React project where it’s not being used at all.


I could have a look at it but is there a simpler way to test package changes than having to create dummy packages?


What do you mean by “test package changes”?


You can’t just edit the .js of a package in your meteor directory. I think you have to create a fork of the package, then install that package? Is there an easier way to do this for prototyping?


Yeah, you can run all of Meteor from a checkout, that’s how we do it: https://github.com/meteor/meteor#slow-start-for-developers


Speaking of getting rid of Blaze, one thing that has bothered me for a long time is the fact that Blaze is a dependency of accounts-twitter.


Basically forcing you to load Blaze if you want to enable your users to log in via Twitter, whether you actually use Blaze or not.


I wonder if we can even make a community effort to soon move this over to NPM? If you already have the boilerplate how to convert meteor packages to NPM I am sure a lot of people (me including!) would be happy to create PRs to convert packages to NPM packages.


Were you successful in removing web app? I’ve been dying to do this


Yes, just remove it and put something like this into your index file (I know, it looks ugly):

global.main = () => {
  if( process.env.NODE_ENV === "development" ) {
    console.log( "Press ^C to exit" )
    while( true ) {}


But I am almost sure, you don’t need Meteor for the app without webapp package.


Oh definitely. It’s just fun to experiment.


Just a note, I tried to get rid of jquery as well, and found that it was Kadira depending on it and keeping it included.