Skip to main content

What is Isobuild?

Isobuild is Meteor’s packaging and build system. The name comes from “isomorphic build” - it compiles the same JavaScript codebase to different architectures: browser, Node.js server, Cordova mobile apps, and even the Meteor tool itself.
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.

Core Concepts

Isopack

Each package used by Isobuild forms an Isopack - a package format containing compiled source code for each architecture it can run on.

Unibuild

Each separate part of an Isopack built for a specific architecture is called a Unibuild.
The name “Unibuild” is historical - we can’t call it “build” (too generic) or “Isobuild” (that’s the system name). A Unibuild represents a single architecture target within an Isopack.

Isopackets

Isopackets are predefined sets of isopacks used inside meteor-tool. The meteor command-line tool loads isopackets into its process to use features like the DDP client.

Build Process Architecture

The Isobuild system consists of several interconnected components:

Key Components

1. Project Context

Created from the app directory, the Project Context:
  • Resolves package versions and dependencies
  • Refreshes package catalogs
  • Prepares packages for building
  • Manages constraint solving
Located in: tools/project-context.js

2. Bundler

The Bundler is the high-level orchestrator. It:
  • Creates Package Sources for the app
  • Compiles app parts as packages
  • Combines everything into deployable bundles
  • Writes star.json and program.json files
Located in: tools/isobuild/bundler.js

3. Compiler

The Compiler handles individual package compilation:
  • Compiles packages into Isopacks
  • Runs compiler batch plugins
  • Executes source handlers (legacy build plugins)
  • Recursively builds build plugins if needed
Located in: tools/isobuild/compiler.js

4. Linker

The Linker is Meteor’s module loading solution. It wraps files and manages imports/exports.
Located in: tools/isobuild/linker.js
The Linker predates ES2015 modules. Meteor is transitioning to native ES modules, but the Linker remains for backwards compatibility.

5. Builder

The Builder manages filesystem writes efficiently:
  • Tracks which files have changed
  • Avoids rewriting unchanged files
  • Uses inodes (not file paths) for running processes
  • Cleans up unlinked files
Located in: tools/isobuild/builder.js

Build Pipeline

Here’s the complete timeline of building a Meteor app:

Step 1: Create Project Context

This:
  • Reads .meteor/packages and .meteor/release
  • Resolves package versions via constraint solver
  • Prepares packages from cache or downloads them

Step 2: Bundle the Application

The Bundler:
  1. Creates Package Source for the app
  2. Compiles app code for each architecture
  3. Links modules and resolves imports
  4. Runs minifiers in production mode
  5. Writes output files

Step 3: Compile Packages

For each package:
The Compiler:
  1. Runs compiler plugins (.jsx.js, .ts.js, etc.)
  2. Processes each architecture (client, server, cordova)
  3. Creates Unibuilds for each architecture
  4. Assembles Isopack from Unibuilds
  5. Caches result in .meteor/local/isopacks/
The Linker:
  1. Prelinking: Wraps files, creates package scope
  2. Linking: Adds import statements
  3. Generates global imports file

Step 5: Write Output

Creates the final bundle structure:

Step 6: Return WatchSet

The WatchSet tracks all files involved in the build:

Build Plugins

Build plugins extend Isobuild’s compilation capabilities.

Compiler Plugin

Compiles specific file types:
Plugin implementation:
plugin.js

Minifier Plugin

Minifies compiled output:

Linter Plugin

Lints source code:

Caching

Isopack Cache

Compiled packages are cached in .meteor/local/isopacks/:
Each contains:
  • isopack.json - Metadata
  • web.browser/ - Client unibuild
  • os/ - Server unibuild

Cache Invalidation

Caches are invalidated when:
  • Source files change
  • Package dependencies update
  • Build plugin configuration changes
  • Meteor version changes

WatchSet

WatchSets track file dependencies for rebuilds:
The WatchSet is passed down through build functions and mutated to accumulate all dependencies. The final WatchSet contains every file that participated in the build.

Architecture Targets

Isobuild compiles for multiple architectures:

Web Architectures

  • web.browser - Modern browsers
  • web.browser.legacy - Legacy browser support
  • web.cordova - Cordova mobile apps

Server Architectures

  • os - Platform-independent Node.js
  • os.linux.x86_64 - Linux 64-bit
  • os.osx.x86_64 - macOS 64-bit
  • os.windows.x86_64 - Windows 64-bit

Example Target Selection

package.js

Performance Optimization

Parallel Compilation

Isobuild compiles packages in parallel when possible:

Incremental Builds

Only recompile changed packages:

Build Profiling

Best Practices

Be aware of which architecture your code targets:
Use tree-shaking friendly imports:
Let Isobuild cache work:
  • Don’t clean .meteor/local/ unnecessarily
  • Use deterministic build plugin output
  • Avoid dynamic imports in package.js

Next: Reactivity

Learn how Meteor’s reactive system automatically updates your UI