Registry / devops / metalsmith-rollup

metalsmith-rollup

JSON →
library2.0.0jsnpmunverified

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.

npm install metalsmith-rollup
INSTALL
IMPORT
SIG · METALSMITH-ROLLUP
M
metalsmith-rollup
devopsjavascriptv2.0.0
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
const rollup = require('metalsmith-rollup')
import rollup from 'metalsmith-rollup'
This package uses CommonJS; ESM import may not work without bundler. Use require() in Node.js.
rollup
const rollup = require('metalsmith-rollup')
const { rollup } = require('metalsmith-rollup')
The entire module is a single function; destructuring will give undefined.
Plugin
import type { Plugin } from 'metalsmith-rollup' // TypeScript only
TypeScript types are available; use import type for type-only imports.

Shows how to use the plugin with Metalsmith to bundle a JavaScript entry point into a single output file.

const Metalsmith = require('metalsmith'); const rollup = require('metalsmith-rollup'); Metalsmith(__dirname) .use(rollup({ input: 'src/js/main.js', output: { dest: 'js/bundle.js' } })) .build((err) => { if (err) throw err; console.log('Build complete'); });
Debug
Known issues
gotchainput path is relative to Metalsmith source directory; output.dest is relative to Metalsmith build directory
fix
Ensure input file exists inside your Metalsmith source folder, and output.dest will be placed in the build folder.
affects: >=1.0.0
gotchaCLI usage via metalsmith.json is not yet supported; only JavaScript API works
fix
Use JavaScript build file with require('metalsmith-rollup') instead of relying on metalsmith.json plugins configuration.
affects: >=1.0.0
deprecatedplugin options object (second argument) structure may change in future versions
fix
Refer to documentation for current options; avoid relying on undocumented properties.
affects: >=1.0.0 <3.0.0
Errors
Common errors & fixes
TypeError: rollup is not a function
Using destructured import when package exports a single function
fix
Use `const rollup = require('metalsmith-rollup');` not `const { rollup } = require('metalsmith-rollup');`
Error: ENOENT: no such file or directory, open '...'
Input file path is incorrect relative to Metalsmith source directory
fix
Make sure the input path starts from your Metalsmith source directory (e.g., 'src/js/main.js' if your Metalsmith source is 'src').
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
rolluprequiredCore bundling engine; must be installed separately
metalsmithrequiredMetalsmith build framework; peer dependency
Agent activity
4 hits · last 30 days
node
4
Resources
metalsmith-rollup — npm install metalsmith-rollup · libregistry