Skip to main content

Isobuild System

Meteor’s packaging system is called Isobuild. It compiles the same JavaScript code-base to different architectures: browser, Node.js-like server environments, or WebView in Cordova mobile apps.

Core Concepts

What is Isobuild?

Isobuild is Meteor’s build and packaging system that knows how to compile code for multiple target architectures from a single source tree. The name comes from “isomorphic build” - the ability to build the same code for different execution environments. From the source code (GLOSSARY.md):
Meteor has a packaging system called “Isobuild”. Isobuild knows how to compile the same JavaScript code-base to different architectures: browser, node.js-like server environment (could be Rhino or other) or a webview in a Cordova mobile app.

Architecture Targeting

Isobuild supports multiple target architectures:
  • web - Base web architecture
  • web.browser - Modern browsers
  • web.browser.legacy - Legacy browser support
  • web.cordova - Cordova mobile apps
  • os - Generic Node.js server
  • os.linux.x86_64 - Platform-specific server builds
  • os.osx.x86_64 - macOS specific builds

Architecture Matching

The system uses sophisticated architecture matching to find the most appropriate build for a given target:

Build Modes

Isobuild supports different build modes that affect which packages are included:
  • production - Default mode, excludes debugOnly packages
  • development - Includes debugOnly packages
  • test - Includes testOnly packages for testing
From bundler.js:

Package Loading Order

Isobuild performs a two-phase topological sort to determine package load order:

Phase 1: Determine Used Packages

Identify all packages (unibuilds) that will be used, following non-weak dependencies.

Phase 2: Determine Load Order

Establish the correct loading sequence where dependencies appear before dependents:

Isopackets

Isopackets are predefined sets of isopacks used inside the meteor-tool itself: From GLOSSARY.md:
An isopacket is a predefined set of isopackages which the meteor command-line tool can load into its process. This is how we use the DDP client and many other packages inside the tool.

Platform Specificity

Packages can be platform-specific if they contain binary builds:

Isobuild Features

Packages can declare dependencies on isobuild features using the isobuild:* pseudo-packages. These ensure the build system has certain capabilities available.

Watch Sets

Isobuild maintains WatchSets to track file dependencies:
The WatchSet enables efficient rebuilds by detecting exactly which files have changed.

Source Root Detection

For packages built from source, Isobuild can determine the original source root:

Build Profiles

The buildArchitectures() method can return simplified or complete architecture lists:

Key Files

  • tools/isobuild/isopack.js - Core Isopack implementation
  • tools/isobuild/bundler.js - Build orchestration
  • tools/isobuild/compiler.js - Compilation logic
  • tools/utils/archinfo.js - Architecture detection and matching