@northerneyes/vite-plugin-importus
v1.0.8
Published
The faster modularly import plugin for Vite.
Downloads
2
Readme
vite-plugin-importus
⚡The faster modularly import plugin, 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.