A Rollup plugin that externalizes assets (e.g., images, fonts) so they are not bundled into the JavaScript output, but are still copied to the output directory with hashed filenames. Current stable version is 4.1.1, released April 2024. The plugin uses Rollup's asset emission system to handle deduplication and hashing. Key differentiators: it avoids bundling assets inline, preserving import paths as require() or dynamic imports pointing to the emitted asset files. It supports include/exclude patterns, custom resolve base directory, and works with static and dynamic imports. TypeScript types are included. Notable breaking changes in v4: switched to named export only (no default export) and changed the function signature.
npm install rollup-plugin-external-assetsVerified import paths — ran on the pinned version, not inferred.
Configures Rollup to externalize PNG and JPG files, copying them to the output directory with hashed names.
Use `import { externalAssets } from 'rollup-plugin-external-assets'` instead of default import.Update plugin call: `externalAssets('assets/*')` or `externalAssets({ include: 'assets/*' })`.Switch to the new function signature.
Use forward slashes in include/exclude patterns (e.g., 'assets/**/*.png').
Upgrade to version 4.1.1 or later.
Use named import: `import { externalAssets } from 'rollup-plugin-external-assets'`.Use `const { externalAssets } = require('rollup-plugin-external-assets')`.Use forward slashes in all patterns and resolve paths, or upgrade to v3.0.0+.
No dependency data recorded yet.