Registry / devops / rollup-plugin-emit-files

rollup-plugin-emit-files

JSON →
library2.0.0jsnpmunverified

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-files
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-EMIT
R
rollup-plugin-emit-files
devopsjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

emitFiles
import emitFiles from 'rollup-plugin-emit-files'
const emitFiles = require('rollup-plugin-emit-files')
Plugin is ESM-only; CommonJS require will fail.
rollup-plugin-emit-files (types)
import type { Options } from 'rollup-plugin-emit-files'
TypeScript users can import the Options type for type-checking plugin configuration.
emitFiles (default export)
import emitFiles from 'rollup-plugin-emit-files'
import { emitFiles } from 'rollup-plugin-emit-files'
The package uses a default export, not a named export.

Shows a basic Rollup configuration using emitFiles to copy all files from the 'static' directory into the output folder 'dist'.

// rollup.config.js import emitFiles from 'rollup-plugin-emit-files'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm' }, plugins: [ emitFiles({ src: 'static', dest: '.', include: ['**/*'], exclude: [] }) ] };
Debug
Known issues
breakingVersion 2.0.0 requires Rollup ^3.2.5. It is incompatible with Rollup 2.x.
fix
Use rollup-plugin-emit-files@1.x for Rollup 2.x, or upgrade to Rollup 3+.
affects: >=2.0.0
gotchaThe src directory must exist and contain files; otherwise the plugin emits silently without warning.
fix
Ensure the src path is correct and contains at least one file matching the include pattern.
affects: >=0.0.0
gotchaThe dest path is relative to the output directory—not from the project root. Misconfiguration can cause files to be placed in unexpected locations.
fix
Use dest: '.' for flat output or e.g. dest: 'assets' to place files inside an assets subfolder within the output directory.
affects: >=0.0.0
deprecatedOlder versions (v1.x) used a different export pattern; upgrading to v2.0.0 may break CommonJS usage.
fix
Switch from require() to import, or use the ESM-compatible configuration.
affects: >=1.0.0 <2.0.0
Errors
Common errors & fixes
Error: The emitFiles plugin must be used with Rollup 3 or higher
rollup-plugin-emit-files v2 has a peer dependency on rollup ^3.2.5, but an older Rollup version is installed.
fix
Upgrade Rollup to version ^3.2.5 using npm install rollup@^3.2.5
TypeError: emitFiles is not a function
Using a named import instead of default import: import { emitFiles } from '...'
fix
Change to default import: import emitFiles from 'rollup-plugin-emit-files'
Cannot find module 'rollup-plugin-emit-files'
The package is not installed or is installed as a devDependency but the build environment doesn't have access.
fix
Run npm install --save-dev rollup-plugin-emit-files
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
rolluprequiredPeer dependency required for Rollup plugin interface
Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
2
Resources
rollup-plugin-emit-files — npm install rollup-plugin-emit-files · libregistry