# vitejs-plugin-vue-route-auto-import

> vue3路由自动引入vitejs插件

Latest version **0.0.27** (published 2026-03-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install vitejs-plugin-vue-route-auto-import
pnpm add vitejs-plugin-vue-route-auto-import
yarn add vitejs-plugin-vue-route-auto-import
bun add vitejs-plugin-vue-route-auto-import
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.27 |
| Published | 2026-03-24 |
| First published | 2023-03-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 43.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | zys |
| Keywords | vue, vitejs, vitejs-plugin, vue-route, auto |

## Links

- npm: https://www.npmjs.com/package/vitejs-plugin-vue-route-auto-import
- Repository: https://github.com/zys8119/vitejs-plugin-vue-route-auto-import
- Issues: https://github.com/zys8119/vitejs-plugin-vue-route-auto-import/issues
- npm.io page: https://npm.io/package/vitejs-plugin-vue-route-auto-import

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.12
- [@vue/compiler-sfc](https://npm.io/package/@vue/compiler-sfc.md) ^3.2.47

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.27 (latest) — 2026-03-24
- 0.0.26 — 2026-03-24
- 0.0.25 — 2026-03-03
- 0.0.24 — 2025-12-30
- 0.0.23 — 2025-12-30
- 0.0.22 — 2025-12-16
- 0.0.21 — 2025-12-16
- 0.0.20 — 2025-06-26
- 0.0.19 — 2023-12-17
- 0.0.18 — 2023-04-18
- 0.0.17 — 2023-03-13
- 0.0.16 — 2023-03-13
- 0.0.15 — 2023-03-13
- 0.0.14 — 2023-03-13
- 0.0.13 — 2023-03-13
- … 12 more at https://npm.io/package/vitejs-plugin-vue-route-auto-import/versions

## README

# vitejs-plugin-vue-route-auto-import

vue3路由自动引入vitejs插件

## 安装

`
npm i vitejs-plugin-vue-route-auto-import
`
## 使用方法

1. vite.config.ts

```typescript
import {defineConfig} from "vite"
import AutoRoute from 'vitejs-plugin-vue-route-auto-import'
export default defineConfig({
    plugins:[
        AutoRoute({
            /**
             * 动态生成的route文件名称，默认输出在根目录，且名称为 route
             */
            // route:string
            /**
             * 动态生成的路由文件后缀名称，默认 ts
             */
            // route_suffix:string
            /**
             * 被监听的动态路由的文件类型，默认为 ["vue","jsx","tsx"]
             */
            // suffix:string[]
            /**
             * 被监听文件类型所属的目录名称，可以指路径写法，默认为 views
             */
            // views:string
            /**
             * 被监听文件类型所属的页面配置文件，默认为 page.json
             */
            // pageJson:string
            /**
             * 扩展路由的文件位置，可实现传统配置写法
             */
            // routes_extend?:string
            /**
             * 自定义路由配置文件位置，可覆盖路由模式等功能
             */
            // routesCustomConfig?:string
            /**
             * 过滤被不需要动态生成的文件路由，默认为禁止弹框相关的文件，即 /\/alert\//
             */
            // routesFilter:RegExp | string
        })
    ]
})
```

2. main.ts

```typescript
import App from "./App.vue"
import route from "./route"
const app = createApp(App)
.use(route)
app.mount('#app')
```


## ts类型兼容请引入

tsconfig.json

```json
{
    "compilerOptions": {
        // ...
        "types": [
            //....
            "vitejs-plugin-vue-route-auto-import/type"
        ]
    }
}
```

---
_Source: https://npm.io/package/vitejs-plugin-vue-route-auto-import · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
