{"id":22131,"library":"rollup-plugin-mjml","title":"rollup-plugin-mjml","description":"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.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/daankauwenberg/rollup-plugin-mjml","tags":["javascript","rollup","rollup-plugin","mjml"],"install":[{"cmd":"npm install rollup-plugin-mjml","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-mjml","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-mjml","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for compiling MJML templates","package":"mjml","optional":false},{"reason":"Used for pattern matching (include/exclude) and file handling","package":"@rollup/pluginutils","optional":false}],"imports":[{"note":"Rollup plugins are typically imported as default exports in ESM.","wrong":"const mjml = require('rollup-plugin-mjml')","symbol":"default","correct":"import mjml from 'rollup-plugin-mjml'"},{"note":"In CommonJS, the plugin is exported as an ESM default, so require returns an object with a default property.","wrong":"const mjml = require('rollup-plugin-mjml')","symbol":"default","correct":"const mjml = require('rollup-plugin-mjml').default"},{"note":"The plugin is a function, not a constructor; call mjml() to instantiate.","wrong":"export default { plugins: [new mjml()] }","symbol":"default","correct":"export default { plugins: [mjml()] }"}],"quickstart":{"code":"// rollup.config.js\nimport mjml from 'rollup-plugin-mjml';\n\nexport default {\n  input: 'src/main.js',\n  output: { dir: 'dist', format: 'es' },\n  plugins: [\n    mjml({\n      outputDir: 'dist/email',\n      validationLevel: 'strict'\n    })\n  ]\n};\n\n// src/main.js\nimport './template.mjml';\n\nconsole.log('Template compiled!');","lang":"typescript","description":"Shows basic Rollup configuration with rollup-plugin-mjml, importing an MJML file and outputting HTML to a subdirectory."},"warnings":[{"fix":"Ensure your .mjml files are imported (e.g., import './template.mjml') or use @rollup/plugin-multi-entry to include them as entry points.","message":"The plugin does not process .mjml files unless they are imported in your bundle or included via multi-entry.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set outputDir relative to project root, e.g., 'dist/email'.","message":"The outputDir is relative to the current working directory (where Rollup is run), not the output.dir configuration.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Test with your specific versions of Rollup and MJML. Consider using alternative plugins or manual integration.","message":"The plugin has not been updated in over 2 years. It may have compatibility issues with newer versions of MJML or Rollup.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set validationLevel: 'strict' to ensure errors are surfaced during build.","message":"Validation errors in MJML templates may not cause Rollup to fail; they might be silently ignored depending on validationLevel.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run npm install rollup-plugin-mjml --save-dev","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'rollup-plugin-mjml'"},{"fix":"Use const mjml = require('rollup-plugin-mjml').default;","cause":"Using require() incorrectly in CommonJS; the default export is nested.","error":"TypeError: mjml is not a function"},{"fix":"Add mjml() to plugins array in rollup.config.js.","cause":"Rollup cannot resolve .mjml files without a plugin that handles them.","error":"Error: Could not resolve './template.mjml' from 'src/main.js'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}