Skip to content

Latest commit

 

History

History
73 lines (45 loc) · 1.37 KB

README.md

File metadata and controls

73 lines (45 loc) · 1.37 KB

plugin-externals

Rollup plugin to declare dependencies external with reasonable defaults and customizable logic.

Uses is-builtin-module to check for builtin modules.

Changelog

Installation

Using npm:

npm install --save-dev @rollup-extras/plugin-externals

Example

Normal usage:

import externals from '@rollup-extras/plugin-externals';

export default {
	input: 'src/index.js',

    output: {
        format: 'cjs',
        dir: 'dest'
    },

	plugins: [externals()],
}

Options

pluginName

Optional, string.

For debugging purposes, so many instances of a plugin can be differentiated in debugging output.

verbose

Optional, boolean.

Bumps loglevel so more messages go through the default logger filter.

external

Optional, (id: string, external: boolean) => boolean.

Default: id.includes('node_modules') || isBuiltinModule(id) || isOutsideProjectDirectory(id, importer)

Receives in external argument result of default function.

Configuration

type ExternalsPluginOptions = {
    pluginName?: string,
    verbose?: boolean,
    external?: (id: string, external: boolean) => boolean
};

Prior Art

License

MIT