An Eleventy plugin that integrates Rollup into the build pipeline, enabling per-page JavaScript bundling and code splitting. Version 1.3.0 is the current stable release, updated as needed. Unlike running Rollup separately, this plugin shares the Eleventy build context, reducing duplicate bundles and allowing shared modules across pages. It supports both explicit Rollup configuration via options or an external config file, and provides a Liquid/Nunjucks shortcode for including bundled scripts. Notable alternatives like eleventy-plugin-esbuild or manual PostCSS/Webpack setups require more manual wiring. Requires Rollup as a peer dependency; supports Eleventy 1.x and 2.x.
npm install eleventy-plugin-rollupVerified import paths — ran on the pinned version, not inferred.
Shows how to add the plugin with explicit Rollup options in an Eleventy config file.
Set output.format to 'es' or 'system' in rollupOptions.output.
Replace rollupOptions: 'rollup.config.js' with rollupOptions: require('./rollup.config.js') or inline the options.Use CommonJS-compatible Rollup plugins or ensure your config file is transpiled/required correctly.
Set importScriptsAbsoluteFrom to the absolute base URL path (e.g., '/subdir/') in the plugin options.
Add rollupOptions object with valid Rollup config (e.g., { output: { format: 'es', dir: '_site/js' } }).Ensure eleventyConfig.addPlugin(rollupPlugin, ...) is called and the shortcode matches (default: 'rollup').
Add output configuration: { output: { dir: '_site/js', format: 'es' } }.