Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ajuner/vite-plugin-importer
Integration for babel-plugin-import
https://github.com/ajuner/vite-plugin-importer
Last synced: 10 days ago
JSON representation
Integration for babel-plugin-import
- Host: GitHub
- URL: https://github.com/ajuner/vite-plugin-importer
- Owner: ajuner
- License: mit
- Created: 2021-02-22T06:29:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T09:19:49.000Z (over 1 year ago)
- Last Synced: 2024-10-29T17:10:07.243Z (12 days ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/vite-plugin-importer
- Size: 23.4 KB
- Stars: 56
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-importer
[![NPM version](https://img.shields.io/npm/v/vite-plugin-importer.svg)](https://npmjs.org/package//vite-plugin-importer)
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-importer.svg)](https://npmjs.org/package//vite-plugin-importer)Integration for babel-plugin-import
## use
config same as [babel-plugin-import](https://github.com/ant-design/babel-plugin-import)
```
npm install vite-plugin-importer --save
yarn add vite-plugin-importer
``````js
// vite.config.js
import { defineConfig } from "vite";
import usePluginImport from 'vite-plugin-importer'
export default defineConfig({
plugins: [
... // other plugins
usePluginImport({
libraryName: "ant-design-vue",
libraryDirectory: "es",
style: true,
}),
usePluginImport({
libraryName: "antd",
libraryDirectory: "es",
style: true,
}),
usePluginImport({
libraryName: 'vant',
libraryDirectory: 'es',
style: (name) => `${name}/style/less`,
}),
usePluginImport({
libraryName: 'element-plus',
customStyleName: (name) => {
return `element-plus/lib/theme-chalk/${name}.css`;
},
}),
usePluginImport({
libraryName: "@arco-design/web-react",
libraryDirectory: 'es',
camel2DashComponentName: false,
style: true,
})
// Other configurations welcome PR
];
})```
## LICENSE
[MIT](./LICENSE)