{"id":41889,"library":"rollup-plugin-ejs","title":"rollup-plugin-ejs","description":"A Rollup plugin that loads .ejs (Embedded JavaScript) template files, either returning a compiled render function or rendering to HTML at build time. Current stable version is 4.0.1. Supports file inclusion, SCSS compilation via a linked sass peer dependency, HTML minification via html-minifier, and CSS inlining via the inlineStyles option. The plugin dynamically imports peer dependencies, requiring Node 13.2.0+ when bundling in es format. It is a focused EJS integration for Rollup with no major alternatives in the npm ecosystem.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/trofima/rollup-plugin-ejs","tags":["javascript","rollup-plugin","ejs","template"],"install":[{"cmd":"npm install rollup-plugin-ejs","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-ejs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-ejs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional peer dependency for HTML minification via the render.minifierOptions option.","package":"html-minifier","optional":true},{"reason":"Optional peer dependency for compiling .scss files when inlineStyles is enabled.","package":"sass","optional":true}],"imports":[{"note":"ESM-only; require() may not work depending on the bundler and Node version.","wrong":"const ejs = require('rollup-plugin-ejs')","symbol":"default","correct":"import ejs from 'rollup-plugin-ejs'"},{"note":"The plugin exports a single default function; named import 'ejs' is incorrect.","wrong":"import { ejs } from 'rollup-plugin-ejs'","symbol":"default","correct":"import ejs from 'rollup-plugin-ejs'"},{"note":"TypeScript users can import the EjsOptions type for configuration; only works with TypeScript 3.8+ and esModuleInterop.","wrong":"","symbol":"EjsOptions","correct":"import type { EjsOptions } from 'rollup-plugin-ejs'"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport ejs from 'rollup-plugin-ejs';\n\nrollup({\n  input: 'main.js',\n  plugins: [\n    ejs({\n      include: ['**/*.ejs', '**/*.html'],\n      exclude: ['**/index.html'],\n      compilerOptions: { client: true },\n      render: {\n        data: { title: 'Hello' },\n        minifierOptions: { removeComments: true }\n      },\n      inlineStyles: true\n    })\n  ]\n}).then(bundle => bundle.write({ dir: 'dist', format: 'es' }));","lang":"javascript","description":"Rollup configuration using rollup-plugin-ejs with compiler options, render data, and inline styles enabled."},"warnings":[{"fix":"Install relevant peer dependencies: npm install sass html-minifier --save-dev","message":"In v4, sass and html-minifier are moved to peerDependencies and must be installed manually if needed.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Update your configuration: replace loadStyles: true with inlineStyles: true","message":"In v4, the loadStyles option is renamed to inlineStyles.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure your Node.js version is >=13.2.0 or switch to a different format like cjs.","message":"The plugin uses dynamic import() for peer dependencies, which requires Node 13.2.0+ when bundling in es format.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Install sass as a dev dependency: npm install sass --save-dev","message":"If inlineStyles is enabled, the plugin will attempt to compile .scss files via the sass peer dependency; failure to install sass will cause an error.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Access data via <%= locals.dataKey %> in your ejs templates.","message":"The plugin expects ejs templates to use the 'locals' variable for data by default; not using it can lead to runtime errors.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'13.2.0':65 '4.0.1':32 'altern':82 'build':26 'bundl':67 'compil':18,37 'css':51 'current':28 'depend':43,62 'dynam':59 'ecosystem':86 'either':15 'ej':4,10,75,91 'embed':11 'es':69 'file':14,34 'focus':74 'format':70 'function':20 'html':24,44,48 'html-minifi':47 'import':60 'inclus':35 'inlin':52 'inlinestyl':55 'integr':76 'javascript':12,87 'link':40 'load':9 'major':81 'minif':45 'minifi':49 'node':64 'npm':85 'option':56 'peer':42,61 'plugin':3,7,58,90 'render':19,22 'requir':63 'return':16 'rollup':2,6,78,89 'rollup-plugin':88 'rollup-plugin-ej':1 'sass':41 'scss':36 'stabl':29 'support':33 'templat':13,92 'time':27 'version':30 'via':38,46,53","created_at":"2026-06-04T18:54:35.851013+00:00","updated_at":"2026-06-04T18:54:35.851013+00:00","problems":[{"fix":"Install sass: npm install sass --save-dev","cause":"The inlineStyles option is enabled but sass peer dependency is not installed.","error":"Error: Cannot find module 'sass'"},{"fix":"Install html-minifier: npm install html-minifier --save-dev","cause":"The render.minifierOptions option is used but html-minifier peer dependency is not installed.","error":"Error: Cannot find module 'html-minifier'"},{"fix":"Use default import: import ejs from 'rollup-plugin-ejs'","cause":"Using named import { ejs } instead of default import ejs.","error":"TypeError: ejs is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/trofima/rollup-plugin-ejs","github":"https://github.com/trofima/rollup-plugin-ejs","docs":null,"changelog":null,"pypi":null,"npm":"rollup-plugin-ejs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}