Registry / communication / rollup-plugin-mjml

rollup-plugin-mjml

JSON →
library1.0.3jsnpmunverified

Rollup plugin to compile MJML templates into HTML during the build process. Current version 1.0.3, released in 2020. The plugin works by importing .mjml files in JavaScript or using @rollup/plugin-multi-entry to bundle templates. It outputs HTML files to a specified directory, with options for validation level and output extension. This plugin bridges the gap between Rollup bundling and MJML email template compilation, allowing integration into modern build pipelines. Longer release cadence; last update over 2 years ago.

npm install rollup-plugin-mjml
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-MJML
R
rollup-plugin-mjml
communicationjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import mjml from 'rollup-plugin-mjml'
const mjml = require('rollup-plugin-mjml')
Rollup plugins are typically imported as default exports in ESM.
default
const mjml = require('rollup-plugin-mjml').default
const mjml = require('rollup-plugin-mjml')
In CommonJS, the plugin is exported as an ESM default, so require returns an object with a default property.
default
export default { plugins: [mjml()] }
export default { plugins: [new mjml()] }
The plugin is a function, not a constructor; call mjml() to instantiate.

Shows basic Rollup configuration with rollup-plugin-mjml, importing an MJML file and outputting HTML to a subdirectory.

// rollup.config.js import mjml from 'rollup-plugin-mjml'; export default { input: 'src/main.js', output: { dir: 'dist', format: 'es' }, plugins: [ mjml({ outputDir: 'dist/email', validationLevel: 'strict' }) ] }; // src/main.js import './template.mjml'; console.log('Template compiled!');
Debug
Known issues
gotchaThe plugin does not process .mjml files unless they are imported in your bundle or included via multi-entry.
fix
Ensure your .mjml files are imported (e.g., import './template.mjml') or use @rollup/plugin-multi-entry to include them as entry points.
affects: >=1.0.0
gotchaThe outputDir is relative to the current working directory (where Rollup is run), not the output.dir configuration.
fix
Set outputDir relative to project root, e.g., 'dist/email'.
affects: >=1.0.0
deprecatedThe plugin has not been updated in over 2 years. It may have compatibility issues with newer versions of MJML or Rollup.
fix
Test with your specific versions of Rollup and MJML. Consider using alternative plugins or manual integration.
affects: >=1.0.0
gotchaValidation errors in MJML templates may not cause Rollup to fail; they might be silently ignored depending on validationLevel.
fix
Set validationLevel: 'strict' to ensure errors are surfaced during build.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-mjml'
Package not installed or not in node_modules.
fix
Run npm install rollup-plugin-mjml --save-dev
TypeError: mjml is not a function
Using require() incorrectly in CommonJS; the default export is nested.
fix
Use const mjml = require('rollup-plugin-mjml').default;
Error: Could not resolve './template.mjml' from 'src/main.js'
Rollup cannot resolve .mjml files without a plugin that handles them.
fix
Add mjml() to plugins array in rollup.config.js.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
mjmlrequiredCore dependency for compiling MJML templates
@rollup/pluginutilsrequiredUsed for pattern matching (include/exclude) and file handling
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
rollup-plugin-mjml — npm install rollup-plugin-mjml · libregistry