UNPKG

@hf-/vite-plugin-auto-router

Version:

A Vite plugin for auto-generating Vue router configuration based on file system

29 lines (25 loc) 656 B
import { Plugin } from 'vite'; interface AutoRouterOptions { /** * 视图文件所在的目录 * @default 'src/views' */ viewsDir?: string; /** * 路由配置的输出路径 * @default 'src/router/routes.ts' */ outputPath?: string; /** * 是否将文件名中的下划线转换为动态路由参数 * @default true */ dynamicRouteFromUnderscore?: boolean; /** * 是否移除重复的目录名和文件名 * @default true */ removeRedundantSegments?: boolean; } declare function autoRouter(options?: AutoRouterOptions): Plugin; export { autoRouter as default };