[Meteor 1.3] Large project build speed


Hi all,

tl:dr Including big NPM modules, like THREE.js, directly in the package you’re developing massively increases build/reload time. Instead, create another package and export their NPM modules’ top-level object. Packages are only rebuilt when something inside them changes. This is easier in 1.3 because you can require on the client.

I didn’t realise the problem until late in the day. Here’s everything else we did to reduce build/reload time (I think they improved things but can’t be sure):

  • NODE_ENV=production
  • Place all code inside packages (less files loaded by the browser: one per package)
  • Temporarily removed minifiers
  • Remove all unused standard packages
  • Temporarily remove packages that provide parts of the app that aren’t under development
  • Replace CoffeeScript with plain JavaScript to invoke fewer builders
  • Disable source maps in browser so less files are loaded.
  • Move Less/CSS into it’s own package to it doesn’t get rebuild/concatenated.

Some parts of the app are developed as stand-alone NPM modules. However, if you do this under Meteor’s PACKAGE_DIRS, Meteor will watch your node_modules, even though it only contains local development and testing modules. Solution: move the project out of PACKAGE_DIRS and use gulp to build it into the Meteor package directory.

  • Also tried working from a tmpfs. That was scary.

Build/reload time has gone from ~20s server/client reload to ~4s


Please make sure to post this stuff on the respective GitHub issues in the meteor repo.



Times have changed and lot of this doesn’t apply. We rewrote our application in ES6 with modules as a single app (not packages), and removed all npm wrapper packages and replaced with real npm modules. Build speed is higher (but still too slow).