nuxt-router

Nuxt module to use router.js instead of pages/ directory.

Usage no npm install needed!

<script type="module">
  import nuxtRouter from 'https://cdn.skypack.dev/nuxt-router';
</script>

README

Nuxt Router Module

Nuxt module to use router.js instead of pages/ directory.

Setup

  1. Install vovarevenko/nuxt-router dependency with yarn or npm
  2. Add vovarevenko/nuxt-router to modules section of nuxt.config.js:
{
  modules: [
    // without options
    'vovarevenko/nuxt-router',
    
    // with options
    [
      'vovarevenko/nuxt-router',
      {
        path: 'router',
        filename: 'index.js',
        templateName: 'router.js',
      },
    ],
  ]
}
  1. If you are using SPA mode, add an index / route to generate section of nuxt.config.js:
{
  generate: {
    routes: [
      '/'
    ]
  }
}

License

MIT License

Copyright (c) 2018 Vova Revenko vova@revenko.org