Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Geocld/vite-plugin-importus
Modularly import plugin, compatible with antd, lodash, material-ui and so on.
https://github.com/Geocld/vite-plugin-importus
Last synced: 18 days ago
JSON representation
Modularly import plugin, compatible with antd, lodash, material-ui and so on.
- Host: GitHub
- URL: https://github.com/Geocld/vite-plugin-importus
- Owner: Geocld
- License: mit
- Created: 2022-07-18T02:59:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T01:04:31.000Z (about 1 year ago)
- Last Synced: 2024-10-01T00:56:24.342Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 160 KB
- Stars: 24
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/umijs/babel-plugin-import) but support [Vite](https://github.com/vitejs/vite).
> refer to [vite-plugin-import](https://github.com/meowtec/vite-plugin-import) and [vite-plugin-importer](https://github.com/ajuner/vite-plugin-importer) but is faster! `vite-plugin-importus` use [acron](https://github.com/acornjs/acorn) and [es-module-lexer](https://github.com/guybedford/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`:```js
import vitePluginImportus from 'vite-plugin-importus'const config = {
plugins: [
vitePluginImportus([
{
libraryName: 'antd',
libraryDirectory: 'es',
style: 'css',
}
]),
],
}
```app code:
```javascript
import { Button } from 'antd';
ReactDOM.render(xxxx);↓ ↓ ↓ ↓ ↓ ↓
import { Button } from 'antd/es/button/index'
import 'antd-mobile/es/button/style/css'ReactDOM.render(xxxx)
```## Options
See [babel-plugin-import](https://github.com/umijs/babel-plugin-import#options) for more detail.