Registry / http-networking / rollup-plugin-amd

rollup-plugin-amd

JSON →
library4.0.0jsnpmunverified

Rollup plugin that converts AMD modules (e.g., RequireJS) to ES2016 modules for bundling. Version 4.0.0 requires Node >=8 and Rollup 1.x+. It wraps the amd-to-es6 converter and provides include/exclude filtering and a rewire function to map AMD dependency IDs to file paths. Compared to manual conversion, it automates the transform within the Rollup build pipeline. Release cadence is low; last major update was in 2019.

npm install rollup-plugin-amd
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-AMD
R
rollup-plugin-amd
http-networkingjavascriptv4.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 (amd)
import amd from 'rollup-plugin-amd'
const amd = require('rollup-plugin-amd')
ESM-only; the package does not export a CommonJS version. Use dynamic import if needed in CJS.
amd (named)
import amd from 'rollup-plugin-amd'
import { amd } from 'rollup-plugin-amd'
There is no named export; only a default export.
Plugin as Rollup plugin
amd({ include: 'src/**', exclude: ['node_modules/**'] })
new amd()
The plugin is a function, not a class. Do not use 'new'.

Shows basic usage: import the plugin, create a Rollup config, apply the plugin with include/exclude and a custom rewire function.

import { rollup } from 'rollup'; import amd from 'rollup-plugin-amd'; async function build() { const bundle = await rollup({ input: 'main.js', plugins: [ amd({ include: 'src/**', exclude: ['node_modules/**'], rewire: (moduleId, parentPath) => { // Map AMD module IDs to file paths return './javascripts/' + moduleId; } }) ] }); await bundle.write({ file: 'bundle.js', format: 'iife' }); } build().catch(console.error);
Debug
Known issues
breakingPugin v4.0.0 only supports Rollup 1.x. May not work with Rollup 2+ or newer.
fix
Consider using an alternative plugin that supports modern Rollup, or downgrade Rollup to 1.x.
affects: >=4.0.0
deprecatedThe package uses the deprecated 'rollup.watch' in older versions.
fix
Upgrade to v4.0.0 or later.
affects: <4.0.0
gotchaThe 'rewire' function must return a relative path; otherwise imports may be resolved incorrectly.
fix
Ensure the returned path is relative to the current file, not absolute.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-amd'
Forgot to install the plugin or are using a CJS require in an ESM-only package.
fix
Run 'npm install --save-dev rollup-plugin-amd' and use import syntax.
The 'code' argument must be a string in amd-to-es6
The plugin received a non-string file content, possibly due to a virtual file plugin conflict.
fix
Ensure the file being transformed is a plain JavaScript file.
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
rollupoptionalPeer dependency; plugin requires Rollup to function.
Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-amd — npm install rollup-plugin-amd · libregistry