auto-import-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

auto-import-webpack-plugin

Getting Started

To begin, you'll need to install auto-import-webpack-plugin:

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

or

yarn add -D auto-import-webpack-plugin

or

pnpm add -D auto-import-webpack-plugin

Then add the plugin to your webpack config. For example:

webpack.config.js

const AutoImport = require("auto-import-webpack-plugin");

module.exports = {
  plugins: [
    new AutoImport({
      entry: ".", // entry path
      output: "auto-import.js", // output path
      library: "element-ui", // library name
      ignore: ".autoignore", // entry ignore files config
      logLevel: true, // log level
    }),
  ],
};

or

import AutoImport from "auto-import-webpack-plugin";

export default {
  plugins: [
    new AutoImport({
      entry: ".", // entry path
      output: "auto-import.js", // output path
      library: "element-ui", // library name
      ignore: ".autoignore", // entry ignore files config
      logLevel: true, // log level
    }),
  ],
};

Then add the scripts to your package.json config. For example:

package.json

"scripts": {
  "generator": "auto-import"
},
"devDependencies": {
  "auto-import-webpack-plugin": "latest"
}

auto-import Description

-h, --help   : cli help
-v, --version: package version
-c, --config : config filename default: 'atconfig.json'

auto-import -c atconfig.json

autoconfig.json

{
  "entry": ".",
  "output": "auto-import.js",
  "library": "element-ui",
  "ignore": ".autoignore",
  "logLevel": true
}

auto-import -c atconfig.js

autoconfig.js

module.exports = {
  entry: ".",
  output: "auto-import.js",
  library: "element-ui",
  ignore: ".autoignore",
  logLevel: true,
};

TypeScript

.d.ts

License

MIT

Package Sidebar

Install

npm i auto-import-webpack-plugin

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

33.1 kB

Total Files

9

Last publish

Collaborators

  • wc19950724