{"library":"rollup-plugin-external-assets","title":"rollup-plugin-external-assets","description":"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.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install rollup-plugin-external-assets"],"cli":null},"imports":["import { externalAssets } from 'rollup-plugin-external-assets'","const { externalAssets } = require('rollup-plugin-external-assets')","import type { ExternalAssetsOptions } from 'rollup-plugin-external-assets'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// rollup.config.js\nimport { externalAssets } from 'rollup-plugin-external-assets';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'cjs'\n  },\n  plugins: [\n    externalAssets([\n      '**/*.png',\n      '**/*.jpg'\n    ])\n  ]\n};\n\n// src/index.js\nimport logo from './assets/logo.png';\nconsole.log(logo); // './assets/logo-abc123.png'","lang":"javascript","description":"Configures Rollup to externalize PNG and JPG files, copying them to the output directory with hashed names.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}