Registry / testing / rollup-plugin-ephemeral

rollup-plugin-ephemeral

JSON →
library0.0.1jsnpmunverified

A Rollup plugin for creating virtual modules that behave like real files, useful for testing or generating modules on-the-fly. Version 0.0.1 is the initial unstable release. Different from @rollup/plugin-virtual in that ephemeral modules are treated as real file modules by Rollup, affecting resolution and caching behavior. This package ships TypeScript types and supports ESM only.

npm install rollup-plugin-ephemeral
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-EPHE
R
rollup-plugin-ephemeral
testingjavascriptv0.0.1
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.

ephemeral
import ephemeral from 'rollup-plugin-ephemeral'
const ephemeral = require('rollup-plugin-ephemeral')
This package is ESM-only; CommonJS require() will fail.
ephemeral (named export)
import { ephemeral } from 'rollup-plugin-ephemeral'
import { default as ephem } from 'rollup-plugin-ephemeral'
The package only exports a default function; named import is not available.
ephemeral (type import)
import type { RollupPluginEphemeralOptions } from 'rollup-plugin-ephemeral'
import { RollupPluginEphemeralOptions } from 'rollup-plugin-ephemeral'
Types are only available as type-only imports to avoid runtime side effects.

Shows basic usage: create a virtual module entry.js that exports a constant, then bundle with Rollup and output the generated code.

import ephemeral from 'rollup-plugin-ephemeral'; import { rollup } from 'rollup'; const bundle = await rollup({ input: 'entry.js', plugins: [ ephemeral('entry.js', 'export const answer = 42;'), ], }); const { output } = await bundle.generate({ format: 'es' }); console.log(output[0].code);
Debug
Known issues
breakingESM-only: rollup-plugin-ephemeral uses native ES modules. Using require() will throw MODULE_NOT_FOUND.
fix
Use import syntax and ensure your project is configured for ESM (e.g., type: module in package.json).
affects: >=0.0.1
gotchaVirtual modules created by this plugin are treated as real files by Rollup's resolveId hook, which may affect caching and watch mode behavior differently than @rollup/plugin-virtual.
fix
If you need standard virtual module behavior, use @rollup/plugin-virtual instead.
affects: >=0.0.1
gotchaThe plugin does not support side effects via a separate options object; all arguments are positional. Pass only id and code.
fix
Call ephemeral('id', 'code') with exactly two string arguments.
affects: >=0.0.1
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/rollup-plugin-ephemeral/index.js not supported.
The package is ESM-only, but the project is using CommonJS require() to load the plugin.
fix
Switch to dynamic import: const ephemeral = await import('rollup-plugin-ephemeral'); or configure your project as ESM.
TypeError: ephemeral is not a function
Importing the default export incorrectly, e.g., using named import where only default export exists.
fix
Use: import ephemeral from 'rollup-plugin-ephemeral'; Do not use named import: import { ephemeral } from 'rollup-plugin-ephemeral';
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
rollup-plugin-ephemeral — npm install rollup-plugin-ephemeral · libregistry