0.0.12 • Published 3 years ago

rollup-plugin-auto-import v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

rollup-plugin-auto-import

A Rollup plugin which can use utils or npm package direct, this plugin will import them underground

Install

Using npm:

npm install rollup-plugin-auto-import --save-dev

Usage

Create a rollup.config.js configuration file and import the plugin:

import autoImport from 'rollup-plugin-auto-import';
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';

export default {
  input: 'src/index.js',
  output: {
    dir: 'output',
    format: 'cjs'
  },
  plugins: [
    resolve(),
    autoImport({
        exclude: [/\.less\b/], // !! exclude unnecessary file
        inject: {
            vue: ['ref'],
        },
    }),
    typescript({
        target: 'es5',
    }),
  ]
};

Then call rollup either via the CLI or the API.

Options

In addition to the properties and values specified for replacement, users may also specify the options below.

presetDir

Type: String Default: auto-import

specify he directory loaded by default, the content exposed inside can be used directly.

inject

Type: { [key: string]: Array[...string] } Default: {}

Specify the third party module to be loaded.

exclude

Type: String | Array[...String] Default: null

A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.

include

Type: String | Array[...String] Default: null

A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago