Skip to main content

Compiler Plugins

Compiler plugins allow packages to extend Meteor’s build system by registering handlers for specific file types. Unlike legacy source handlers, compiler plugins run in the context of an entire app.

Plugin Architecture

From compiler-plugin.js:
Unlike legacy source handlers (Plugin.registerSourceHandler), compilers run in the context of an entire app. They don’t run when you run meteor publish; whenever they run, they have access to all the files of their type across all packages as well as the app.

CompilerPluginProcessor

The main entry point for processing files with plugins:

Plugin Execution

InputFile API

The InputFile class is the documented API presented to compiler plugins:

File Resolution

Adding Output

JavaScript

CSS

Assets

Lazy Compilation

Plugins can defer expensive compilation:

Linker Cache

The linker caches compilation results:

Watch and Rebuild

HMR Support

Server-Lib Packages

Built-in packages available in build plugins:

Plugin Types

Three types of plugins can be registered:

Compiler Plugins

Linter Plugins

Minifier Plugins

Source Processor Sets

Plugin Loading