vite-plugin-vue-configurable-router
v0.0.12
Published
A vite plugin for vue3 to generate configurable router
Downloads
2
Readme
vite-plugin-vue-configurable-router
Configure your Vue Router routes in vite.config.ts
with this Vite plugin.
Installation
pnpm install vite-plugin-vue-configurable-router
Usage
// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueConfigurableRouter from 'vite-plugin-vue-configurable-router'
export default defineConfig({
plugins: [
vue(),
VueConfigurableRouter({
routes: [
{
path: '/',
component: 'Home',
},
{
path: '/about',
component: 'About',
},
],
}),
],
})
In your main.ts
:
import { createApp } from 'vue'
import { createRouter } from 'vue-router'
import { gerRoutes } from 'vite-plugin-vue-configurable-router'
import App from './App.vue'
const router = createRouter({
history: createWebHistory(),
// Use the routes generated by the plugin
routes: getRoutes(),
})