Documentation Index
Fetch the complete documentation index at: https://mintlify.com/meteor/meteor/llms.txt
Use this file to discover all available pages before exploring further.
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
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.jsonandprogram.jsonfiles
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
tools/isobuild/compiler.js
4. Linker
The Linker is Meteor’s module loading solution. It wraps files and manages imports/exports.Prelink Phase
Prelink Phase
Done in isolation per package:
- Create closure around each file
- Concatenate all files
- Add source comments and metadata
- Parse JS to find global variables
- Create package-level variables with
var
Before
After Prelink
Link Phase
Link Phase
Done when dependency versions are known:
- Create import strings for dependencies
- Add global imports from package exports
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
tools/isobuild/builder.js
Build Pipeline
Here’s the complete timeline of building a Meteor app:Step 1: Create Project Context
- Reads
.meteor/packagesand.meteor/release - Resolves package versions via constraint solver
- Prepares packages from cache or downloads them
Step 2: Bundle the Application
- Creates Package Source for the app
- Compiles app code for each architecture
- Links modules and resolves imports
- Runs minifiers in production mode
- Writes output files
Step 3: Compile Packages
For each package:- Runs compiler plugins (
.jsx→.js,.ts→.js, etc.) - Processes each architecture (client, server, cordova)
- Creates Unibuilds for each architecture
- Assembles Isopack from Unibuilds
- Caches result in
.meteor/local/isopacks/
Step 4: Link Modules
- Prelinking: Wraps files, creates package scope
- Linking: Adds import statements
- Generates global imports file
Step 5: Write Output
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.js
Minifier Plugin
Minifies compiled output:Linter Plugin
Lints source code:Caching
Isopack Cache
Compiled packages are cached in.meteor/local/isopacks/:
isopack.json- Metadataweb.browser/- Client unibuildos/- 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 browsersweb.browser.legacy- Legacy browser supportweb.cordova- Cordova mobile apps
Server Architectures
os- Platform-independent Node.jsos.linux.x86_64- Linux 64-bitos.osx.x86_64- macOS 64-bitos.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
Understand Build Targets
Understand Build Targets
Be aware of which architecture your code targets:
Optimize Imports
Optimize Imports
Use tree-shaking friendly imports:
Leverage Caching
Leverage Caching
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