vue-auto-routing

Generate Vue Router routing automatically
43,097 249
Install
npm install vue-auto-routing
Latest Version:1.0.1
Vue:3
Older releases:2
License:MIT
Last Updated:Sep 6, 2021
Links: GitHub  ·  npm
Maintainer: ktsn

vue-auto-routing

Generate Vue Router routing automatically.

You may want to use vue-cli-plugin-auto-routing which includes all useful features on routing.

Installation

$ npm install -D vue-auto-routing

Requirements

  • webpack >= v4.0.0

Usage

vue-auto-routing resolves Vue Router routing automatically by using vue-route-generator. The routes are generated with the same rules with Nuxt routing.

To use this, you import vue-auto-routing and pass it into Vue Router constructor options.

// Import generated routes
import routes from 'vue-auto-routing'

import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  // Pass the generated routes into the routes option
  routes
})

You also need to add a webpack plugin vue-auto-routing provides. The plugin options are the same as vue-route-generator options

// webpack.config.js

const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')

module.exports = {
  // ... other options ...

  plugins: [
    new VueAutoRoutingPlugin({
      // Path to the directory that contains your page components.
      pages: 'src/pages',

      // A string that will be added to importing component path (default @/pages/).
      importPrefix: '@/pages/'
    })
  ]
}

Related Projects

License

MIT

Related Packages

vue-route-generator

Vue Router route config generator

99,774 149
duplicate-dependencies-webpack-plugin

webpack plugin to find duplicated dependencies from your bundle

332,104 6
@nuxt/friendly-errors-webpack-plugin

Recognizes certain classes of webpack errors and cleans, aggregates and prioriti...

15,832,314 29
vue-ssr-webpack-plugin

webpack plugin for generating a bundle manifest to use with Vue 2.x bundleRender...

100,967

Version History

Version Released License
1.0.1 MIT
0.6.0 MIT
0.5.0 MIT
0.4.1 MIT
0.4.0 MIT