⚡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%.
npm i vite-plugin-importus -D
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>)
See babel-plugin-import for more detail.