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.
Performance Optimization
Optimizing Meteor application performance involves multiple strategies across the build system, runtime, and deployment. This guide covers real-world techniques extracted from the Meteor tooling.Build System Optimizations
Modern Build Stack
Enable the modern build stack for significant performance improvements:- SWC transpiler - Faster alternative to Babel
- SWC minifier - Replaces legacy Terser minifier
- Web arch optimization - Skips legacy builds in development
- Modern watcher - Uses
@parcel/watcherfor faster file watching
Transpiler Performance (SWC)
Meteor has adopted SWC as a faster alternative to Babel. SWC provides significant speed improvements during transpilation.Enable SWC Transpilation
Add to yourpackage.json:
Optimize SWC Performance
Enable verbose mode to identify fallbacks:- Nested imports - Move imports to top level
- Missing SWC plugins - Find SWC equivalents for Babel plugins
Externalize SWC Helpers
Reduce bundle size by centralizing SWC transformation helpers:Minification Strategy
Use the SWC-based minifier for faster production builds:Development Mode Optimizations
Skip Legacy Architectures
In development, skip building for legacy browsers and Cordova:Use Modern Watcher
The modern watcher uses native OS file watching:Rspack Bundler Integration
For maximum performance, integrate Rspack for modern bundling:- Faster builds and reloads
- Smaller bundles via tree shaking
- Native code splitting
- Hot Module Replacement (HMR)
- Support for ESM packages
Split Vendor Chunks
Avoid duplicating libraries in async chunks:Memory Optimization
For large apps hitting memory limits:Constraint Solver Performance
The constraint solver can be optimized through several mechanisms:Version Pinning
MaintainAPP/.meteor/versions to avoid re-solving on every run. The previous solution is checked without invoking the logic solver.
Package Database Optimization
Time spent reading from the packages database (SQLite) can be improved by:- Batching queries
- Reading less data
- Using SQLite more efficiently
CSS Processing Optimization
CSS minification and processing can take 500ms to several seconds:Strategies:
- Use Rspack CSS loaders for faster HMR
- Insert caches around CSS parsing
- Only recalculate CSS when it changes
- Use faster CSS libraries
CSS with Rspack
Migrate styles to Rspack for fastest HMR:File System Optimizations
Hardware Considerations
- SSDs vs Spinning Disks - SSDs are significantly faster
- OS Differences - Windows file operations are slower than Mac/Linux
Symbolic Links and File Operations
On OS X and Linux:- Usable symlinks
- Cheap file renaming
- Atomic file overwrites
- Files can be deleted while open
Source Map Optimization
The tool spends noticeable time building source maps. Consider:- Using the
source-maplibrary more efficiently - Following patterns from other tools like Webpack
Linker Cache Management
The linker cache atAPP/.meteor/local/bundler-cache/linker can have large files that take time to write. Monitor calls to files.writeFileAtomically in production builds.
Import Aliases
Optimize imports with aliases for cleaner code:Best Practices
- Enable modern build stack - Set
"modern": truein package.json - Use Rspack for app code - Add
rspackpackage for modern bundling - Externalize SWC helpers - Install
@swc/helpersto reduce bundle size - Optimize CSS processing - Move to Rspack loaders for faster HMR
- Skip legacy builds in dev - Enable
webArchOnlyfor faster iterations - Use .meteorignore - Exclude unnecessary files from the build
- Monitor bundle size - Use
bundle-visualizerto track bloat - Profile builds - Use
meteor profileto compare performance