vite-plugin-vue-configurable-router
TypeScript icon, indicating that this package has built-in type declarations

0.0.12 • Public • Published

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(),
})

Package Sidebar

Install

npm i vite-plugin-vue-configurable-router

Weekly Downloads

0

Version

0.0.12

License

MIT

Unpacked Size

20.8 kB

Total Files

15

Last publish

Collaborators

  • nailiable