rollup-plugin-commonjs

  • Version 10.1.0
  • Published
  • 212 kB
  • 5 dependencies
  • MIT license

Install

npm i rollup-plugin-commonjs
yarn add rollup-plugin-commonjs
pnpm add rollup-plugin-commonjs

Overview

Convert CommonJS modules to ES2015

Index

Functions

function commonjs

commonjs: (options?: RollupCommonJSOptions) => Plugin;
  • Convert CommonJS modules to ES6, so they can be included in a Rollup bundle

Interfaces

interface RollupCommonJSOptions

interface RollupCommonJSOptions {}

    property exclude

    exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
    • non-CommonJS modules will be ignored, but you can also specifically include/exclude files undefined

    property extensions

    extensions?: ReadonlyArray<string | RegExp>;
    • search for files other than .js files (must already be transpiled by a previous plugin!) [ '.js' ]

    property ignore

    ignore?: ReadonlyArray<string | ((id: string) => boolean)>;
    • sometimes you have to leave require statements unconverted. Pass an array containing the IDs or a id => boolean function. Only use this option if you know what you're doing!

    property ignoreGlobal

    ignoreGlobal?: boolean;
    • if true then uses of global won't be dealt with by this plugin false

    property include

    include?: string | RegExp | ReadonlyArray<string | RegExp>;
    • non-CommonJS modules will be ignored, but you can also specifically include/exclude files undefined

    property namedExports

    namedExports?: { [package: string]: ReadonlyArray<string> };
    • explicitly specify unresolvable named exports ([see below for more details](https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports)) undefined

    property sourceMap

    sourceMap?: boolean;
    • if false then skip sourceMap generation for CommonJS modules true

    Package Files (1)

    Dependencies (5)

    Dev Dependencies (20)

    Peer Dependencies (1)

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rollup-plugin-commonjs.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rollup-plugin-commonjs)
    • HTML
      <a href="https://www.jsdocs.io/package/rollup-plugin-commonjs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>