A Rollup plugin that emits files into the output bundle, useful for copying static assets like images, fonts, or data files during the build process. Current stable version is 2.0.0. It requires Rollup ^3.2.5 and ships TypeScript types. Compared to alternatives like `rollup-plugin-copy`, it integrates directly with Rollup's emit mechanism, ensuring assets appear in the bundle output without separate copy tasks. The plugin supports glob patterns for include/exclude filtering and a destination path relative to the output directory. It is actively maintained with a simple API.
npm install rollup-plugin-emit-filesVerified import paths — ran on the pinned version, not inferred.
Shows a basic Rollup configuration using emitFiles to copy all files from the 'static' directory into the output folder 'dist'.
Use rollup-plugin-emit-files@1.x for Rollup 2.x, or upgrade to Rollup 3+.
Ensure the src path is correct and contains at least one file matching the include pattern.
Use dest: '.' for flat output or e.g. dest: 'assets' to place files inside an assets subfolder within the output directory.
Switch from require() to import, or use the ESM-compatible configuration.
Upgrade Rollup to version ^3.2.5 using npm install rollup@^3.2.5
Change to default import: import emitFiles from 'rollup-plugin-emit-files'
Run npm install --save-dev rollup-plugin-emit-files