wrahim
wrahim

Reputation: 1168

Nuxt is generating unwanted routes, when splitting .vue files. How do I get only the routes I want?

In my Nuxt project, I split up the .vue files in the pages directory to something like:

pages/
  index.vue
  shop/
    index.vue
    shop.js
    shop.pug
    shop.scss
  login/
    index.vue
    login.js
    login.pug
    login.scss

with the shop/index.vue, and login/index.vue src-ing their respective js/pug/scss files.

The routes for /, /shop, /login are working as expected, but I see that some other routes are also being generated: /shop/shop, and /login/login -- which are coming from the shop.js and login.js files I am assuming.

How do I prevent that? I just want it to use index.vue, or any .vue files for generating the routes.

Upvotes: 0

Views: 315

Answers (1)

Andrew Vasylchuk
Andrew Vasylchuk

Reputation: 4779

Put .nuxtignore file in your root.

File content: pages/**/*.js

Reference

Upvotes: 1

Related Questions