{"id":21565,"library":"metalsmith-rollup","title":"metalsmith-rollup","description":"A Metalsmith plugin that bundles JavaScript files using Rollup. Version 2.0.0 is current; it supports source maps and can ignore processed source files. This plugin is designed for Metalsmith build pipelines where you need to bundle ES modules with Rollup. It only supports the JavaScript API; CLI usage with metalsmith.json is not yet available. The main differentiator is its tight integration with Metalsmith's build process, allowing seamless inclusion of bundled output inside the build directory.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/attila/metalsmith-rollup","tags":["javascript","metalsmith","rollup"],"install":[{"cmd":"npm install metalsmith-rollup","lang":"bash","label":"npm"},{"cmd":"yarn add metalsmith-rollup","lang":"bash","label":"yarn"},{"cmd":"pnpm add metalsmith-rollup","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundling engine; must be installed separately","package":"rollup","optional":false},{"reason":"Metalsmith build framework; peer dependency","package":"metalsmith","optional":false}],"imports":[{"note":"This package uses CommonJS; ESM import may not work without bundler. Use require() in Node.js.","wrong":"import rollup from 'metalsmith-rollup'","symbol":"default","correct":"const rollup = require('metalsmith-rollup')"},{"note":"The entire module is a single function; destructuring will give undefined.","wrong":"const { rollup } = require('metalsmith-rollup')","symbol":"rollup","correct":"const rollup = require('metalsmith-rollup')"},{"note":"TypeScript types are available; use import type for type-only imports.","wrong":"","symbol":"Plugin","correct":"import type { Plugin } from 'metalsmith-rollup' // TypeScript only"}],"quickstart":{"code":"const Metalsmith = require('metalsmith');\nconst rollup = require('metalsmith-rollup');\n\nMetalsmith(__dirname)\n  .use(rollup({\n    input: 'src/js/main.js',\n    output: {\n      dest: 'js/bundle.js'\n    }\n  }))\n  .build((err) => {\n    if (err) throw err;\n    console.log('Build complete');\n  });","lang":"javascript","description":"Shows how to use the plugin with Metalsmith to bundle a JavaScript entry point into a single output file."},"warnings":[{"fix":"Ensure input file exists inside your Metalsmith source folder, and output.dest will be placed in the build folder.","message":"input path is relative to Metalsmith source directory; output.dest is relative to Metalsmith build directory","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use JavaScript build file with require('metalsmith-rollup') instead of relying on metalsmith.json plugins configuration.","message":"CLI usage via metalsmith.json is not yet supported; only JavaScript API works","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Refer to documentation for current options; avoid relying on undocumented properties.","message":"plugin options object (second argument) structure may change in future versions","severity":"deprecated","affected_versions":">=1.0.0 <3.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `const rollup = require('metalsmith-rollup');` not `const { rollup } = require('metalsmith-rollup');`","cause":"Using destructured import when package exports a single function","error":"TypeError: rollup is not a function"},{"fix":"Make sure the input path starts from your Metalsmith source directory (e.g., 'src/js/main.js' if your Metalsmith source is 'src').","cause":"Input file path is incorrect relative to Metalsmith source directory","error":"Error: ENOENT: no such file or directory, open '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}