Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including rollup-plugin-ignore with all npm packages installed. Try it out:

var rollupPluginIgnore = require("rollup-plugin-ignore")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

rollup-plugin-ignore v1.0.9

Ignore a module in rollup.js

rollup-plugin-ignore

Prevent a module from showing up in the output bundle. You will get export default {} instead.

Installation

npm install --save-dev rollup-plugin-ignore
yarn add rollup-plugin-ignore --dev

Usage

Let’s say you want to prevent fs and net from being bundled:

import ignore from "rollup-plugin-ignore"

export default {
  input: "main.js",
  plugins: [ignore(["fs", "net"])],
}

To ignore all built-in Node.js modules, use the following:

import { builtinModules } from "module"
import ignore from "rollup-plugin-ignore"

export default {
  input: "main.js",
  plugins: [
    ignore(builtinModules),
  ],
}),

Note: If you are having problems with using @rollup/plugin-commonjs with this plugin, try the temporary fix:

ignore(builtinModules, { commonjsBugFix: true })

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free