Skip to content

Modularly import plugin, compatible with antd, lodash, material-ui and so on.

License

Notifications You must be signed in to change notification settings

Geocld/vite-plugin-importus

Repository files navigation

vite-plugin-importus

⚡Modularly import plugin, compatible with antd, lodash, material-ui and so on. Has higher performance, making your coding life easier, smoother, and nicer :)

refer to babel-plugin-import but support Vite.

refer to vite-plugin-import and vite-plugin-importer but is faster! vite-plugin-importus use acron and es-module-lexer to transform codes internally, transform speed can be increased by 90%.

Install

npm i vite-plugin-importus -D

Usage

vite.config.ts:

import vitePluginImportus from 'vite-plugin-importus'

const config = {
  plugins: [
    vitePluginImportus([
      {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: 'css',
      }
    ]),
  ],
}

app code:

import { Button } from 'antd';
ReactDOM.render(<Button>xxxx</Button>);

           

import { Button } from 'antd/es/button/index'
import 'antd-mobile/es/button/style/css'

ReactDOM.render(<Button>xxxx</Button>)

Options

See babel-plugin-import for more detail.

About

Modularly import plugin, compatible with antd, lodash, material-ui and so on.

Resources

License

Stars

Watchers

Forks

Packages

No packages published