Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.34 KB

README.md

File metadata and controls

47 lines (35 loc) · 1.34 KB

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.