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-resolveVerified import paths — ran on the pinned version, not inferred.
Basic Rollup configuration using wpResolve to externalize WordPress dependencies to global wp.* variables.
Consider using @wordpress/dependency-extraction-webpack-plugin with webpack or migrating to a maintained alternative.
Upgrade to >=1.0.8
Manually add wp_deregister_script / wp_register_script calls, or use dependency-extraction-webpack-plugin if PHP output is needed.
Use the 'include' or 'exclude' options if available, but the plugin has no such configuration. Extend by forking or using other tools.
Use import statement or configure Node.js to support ESM.
Change to: import wpResolve from 'rollup-plugin-wp-resolve';
Ensure WordPress backend enqueues necessary scripts (wp-editor, wp-components, etc.) via wp_enqueue_script or register_block_type.