vite-plugin-scan
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

vite-plugin-scan

动态扫描 vite 插件




Usage 🦕

安装

npm i vite-plugin-scan

配置

// 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)
        })
    ]
})

使用

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 中添加如下配置

{
    "compilerOptions": {
        "types": ["vite-plugin-scan/client"]
    }
}


License

Made with markthree

Published under MIT License.


Readme

Keywords

Package Sidebar

Install

npm i vite-plugin-scan

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

6.39 kB

Total Files

7

Last publish

Collaborators

  • markthree