{"id":22143,"library":"rollup-plugin-no-emit","title":"rollup-plugin-no-emit","description":"A Rollup plugin that conditionally skips file emission during build. v1.3.0 supports Rollup 1.x through 4.x as peer dependencies and ships TypeScript typings. It provides a `match` function receiving the filename and output chunk/asset to decide which generated files to suppress. Unlike Rollup's built-in `output.preserveModules` or `output.emitFile` controls, this plugin gives fine-grained per-file filtering without altering bundle structure. The deprecated `RollupNoEmitOptions` interface has been replaced by `Options`. Simple API with two options: `emit` (boolean override) and `match` (predicate). No runtime dependencies.","status":"active","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/Arnesfield/rollup-plugin-no-emit","tags":["javascript","rollup-plugin","no-emit","exclude","ignore","skip","typescript"],"install":[{"cmd":"npm install rollup-plugin-no-emit","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-no-emit","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-no-emit","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - the plugin operates on Rollup's plugin hooks","package":"rollup","optional":false}],"imports":[{"note":"Package exports a default function; CommonJS require() works since v1.2.0 but ESM is preferred.","wrong":"const noEmit = require('rollup-plugin-no-emit')","symbol":"default (noEmit)","correct":"import noEmit from 'rollup-plugin-no-emit'"},{"note":"Both default and named exports exist; named export is available for consistency.","wrong":"import noEmit from 'rollup-plugin-no-emit'","symbol":"noEmit (named)","correct":"import { noEmit } from 'rollup-plugin-no-emit'"},{"note":"Options is a TypeScript type; use type import to avoid runtime inclusion.","wrong":"import { Options } from 'rollup-plugin-no-emit'","symbol":"Options","correct":"import type { Options } from 'rollup-plugin-no-emit'"},{"note":"Deprecated since v1.2.0; replaced by Options. Will be removed in next major.","wrong":"","symbol":"RollupNoEmitOptions (deprecated)","correct":"import type { RollupNoEmitOptions } from 'rollup-plugin-no-emit'"}],"quickstart":{"code":"import noEmit from 'rollup-plugin-no-emit';\n\nexport default {\n  input: 'src/index.js',\n  output: { dir: 'dist' },\n  plugins: [\n    noEmit({\n      match: (fileName, output) => fileName === 'index.js' && output.type === 'chunk'\n    })\n  ]\n};","lang":"typescript","description":"Example rollup.config.js using noEmit with a match function that skips emission of 'index.js' chunks."},"warnings":[{"fix":"Replace type references from RollupNoEmitOptions to Options.","message":"RollupNoEmitOptions interface is deprecated; use Options instead.","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"Update match callback to accept the new signature: (fileName, output) => boolean.","message":"In v1.0.0, match function signature changed to include second parameter (output: OutputChunk | OutputAsset).","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Ensure Rollup configuration has output specified.","message":"Plugin only works in the generateBundle hook; output must be defined.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Test match conditions thoroughly when combining with other output options.","message":"Using noEmit with output.preserveModules or manualChunks may lead to unexpected behavior as the plugin suppresses files after chunking.","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":"Check that output.dir or output.file is set in Rollup config.","cause":"match function called with undefined/null output chunk when output is not properly configured.","error":"Error: Rollup's generateBundle hook: Cannot read properties of null (reading 'fileName')"},{"fix":"Use const noEmit = require('rollup-plugin-no-emit').default; or switch to ESM import.","cause":"Importing the constructor function when using CommonJS require incorrectly: const noEmit = require('rollup-plugin-no-emit'); but actual export is an object with default.","error":"TypeError: noEmit is not a function"},{"fix":"Run npm install --save-dev rollup-plugin-no-emit","cause":"Package not installed.","error":"Error: Cannot find module 'rollup-plugin-no-emit'"},{"fix":"Use import type { Options } from 'rollup-plugin-no-emit';","cause":"Imported Options as a value instead of type.","error":"TS2304: Cannot find name 'Options'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}