{"id":22004,"library":"rollup-plugin-ephemeral","title":"rollup-plugin-ephemeral","description":"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.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","rollup-plugin","typescript"],"install":[{"cmd":"npm install rollup-plugin-ephemeral","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-ephemeral","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-ephemeral","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is ESM-only; CommonJS require() will fail.","wrong":"const ephemeral = require('rollup-plugin-ephemeral')","symbol":"ephemeral","correct":"import ephemeral from 'rollup-plugin-ephemeral'"},{"note":"The package only exports a default function; named import is not available.","wrong":"import { default as ephem } from 'rollup-plugin-ephemeral'","symbol":"ephemeral (named export)","correct":"import { ephemeral } from 'rollup-plugin-ephemeral'"},{"note":"Types are only available as type-only imports to avoid runtime side effects.","wrong":"import { RollupPluginEphemeralOptions } from 'rollup-plugin-ephemeral'","symbol":"ephemeral (type import)","correct":"import type { RollupPluginEphemeralOptions } from 'rollup-plugin-ephemeral'"}],"quickstart":{"code":"import ephemeral from 'rollup-plugin-ephemeral';\nimport { rollup } from 'rollup';\n\nconst bundle = await rollup({\n  input: 'entry.js',\n  plugins: [\n    ephemeral('entry.js', 'export const answer = 42;'),\n  ],\n});\nconst { output } = await bundle.generate({ format: 'es' });\nconsole.log(output[0].code);","lang":"typescript","description":"Shows basic usage: create a virtual module entry.js that exports a constant, then bundle with Rollup and output the generated code."},"warnings":[{"fix":"Use import syntax and ensure your project is configured for ESM (e.g., type: module in package.json).","message":"ESM-only: rollup-plugin-ephemeral uses native ES modules. Using require() will throw MODULE_NOT_FOUND.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"If you need standard virtual module behavior, use @rollup/plugin-virtual instead.","message":"Virtual 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.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Call ephemeral('id', 'code') with exactly two string arguments.","message":"The plugin does not support side effects via a separate options object; all arguments are positional. Pass only id and code.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Switch to dynamic import: const ephemeral = await import('rollup-plugin-ephemeral'); or configure your project as ESM.","cause":"The package is ESM-only, but the project is using CommonJS require() to load the plugin.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/rollup-plugin-ephemeral/index.js not supported."},{"fix":"Use: import ephemeral from 'rollup-plugin-ephemeral'; Do not use named import: import { ephemeral } from 'rollup-plugin-ephemeral';","cause":"Importing the default export incorrectly, e.g., using named import where only default export exists.","error":"TypeError: ephemeral is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}