Registry / devops / rollup-plugin-wp-resolve

rollup-plugin-wp-resolve

JSON →
library1.0.9jsnpmunverified

A Rollup plugin that externalizes WordPress and Gutenberg dependencies, converting imports like '@wordpress/components' to global 'wp.*' globals (e.g., 'wp.components.ToggleControl'). Works with Rollup >=1.0.0. Inspired by WordPress dependency-extraction-webpack-plugin, it automatically handles @wordpress/* packages and common bundled libraries (jQuery, lodash, moment, React, ReactDOM). Avoids issues with camelCase conversions since v1.0.8. Stable at v1.0.9 but no recent updates; does not generate PHP dependency files for block registration.

npm install rollup-plugin-wp-resolve
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-WP-R
R
rollup-plugin-wp-resolve
devopsjavascriptv1.0.9
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wpResolve
✓ import wpResolve from 'rollup-plugin-wp-resolve';
✗ const wpResolve = require('rollup-plugin-wp-resolve');
ESM-only package; CommonJS require will fail.
default
✓ import wpResolve from 'rollup-plugin-wp-resolve';
✗ import { wpResolve } from 'rollup-plugin-wp-resolve';
Default export only; named import will be undefined.
wpResolve
✓ import wpResolve from 'rollup-plugin-wp-resolve';
✗ import * as wpResolve from 'rollup-plugin-wp-resolve';
Namespace import results in { default: ... }. Use default import instead.

Basic Rollup configuration using wpResolve to externalize WordPress dependencies to global wp.* variables.

import wpResolve from 'rollup-plugin-wp-resolve'; export default { input: 'src/index.js', output: { dir: 'output', format: 'iife' }, plugins: [wpResolve()] };
Debug
Known issues
deprecatedPackage has not been updated since 2020; may not support latest Rollup versions.
fix
Consider using @wordpress/dependency-extraction-webpack-plugin with webpack or migrating to a maintained alternative.
affects: >=1.0.9
breakingVersions < 1.0.8 had a camelCasing bug that mapped 'wp.i18n' to 'wp.i18N' for certain imports.
fix
Upgrade to >=1.0.8
affects: <1.0.8
gotchaDoes not generate PHP files for block registration; only externalizes dependencies in the Rollup output.
fix
Manually add wp_deregister_script / wp_register_script calls, or use dependency-extraction-webpack-plugin if PHP output is needed.
affects: all
gotchaOnly converts known @wordpress/* packages and a limited set of third-party libraries (jQuery, lodash, moment, React, ReactDOM).
fix
Use the 'include' or 'exclude' options if available, but the plugin has no such configuration. Extend by forking or using other tools.
affects: all
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Using CommonJS require() on an ESM-only package.
fix
Use import statement or configure Node.js to support ESM.
TypeError: wpResolve is not a function
Using named import { wpResolve } instead of default import wpResolve.
fix
Change to: import wpResolve from 'rollup-plugin-wp-resolve';
Unresolved import: @wordpress/... (missing global variable wp...)
Global 'wp' object not available at runtime because WordPress script enqueuing is missing.
fix
Ensure WordPress backend enqueues necessary scripts (wp-editor, wp-components, etc.) via wp_enqueue_script or register_block_type.
Upgrade
Version history
1.0.9latest on npm
Audit
Dependencies
rolluprequiredPeer dependency for Rollup plugin runtime
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-wp-resolve — npm install rollup-plugin-wp-resolve · libregistry