Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dishait/vite-plugin-scan
动态扫描 vite 插件
https://github.com/dishait/vite-plugin-scan
plugin vite vue
Last synced: 4 days ago
JSON representation
动态扫描 vite 插件
- Host: GitHub
- URL: https://github.com/dishait/vite-plugin-scan
- Owner: dishait
- License: mit
- Created: 2022-03-20T05:23:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T08:30:39.000Z (9 months ago)
- Last Synced: 2024-10-03T09:07:15.375Z (about 2 months ago)
- Topics: plugin, vite, vue
- Language: JavaScript
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-scan
动态扫描 vite 插件
## Usage 🦕
### 安装
```shell
npm i vite-plugin-scan
```
### 配置
```ts
// vite.config.js
import { defineConfig } from 'vite'
import Scan from 'vite-plugin-scan'
import Vue from '@vitejs/plugin-vue'export default defineConfig({
plugins: [
Vue(),
Scan({
objectMode: false, // 对象模式,默认为 false
source: 'modules/**/*' // 必需选项,目标目录 (glob)
})
]
})
```
### 使用
```ts
import { createApp } from 'vue'
import App from './App.vue'
import { files } from 'virtual:scan'const app = createApp(App)
console.log(files) // 获取文件
app.mount('#app')
```
### 类型声明
如果你是 `ts` 项目,可以在 `tsconfig.json` 中添加如下配置
```json
{
"compilerOptions": {
"types": ["vite-plugin-scan/client"]
}
}
```
## License
Made with [markthree](https://github.com/markthree)
Published under [MIT License](./LICENSE).