How to ignore a .ts/.js file in nuxt to not be generated in routes?

Viewed 451

i'm new to nuxt.js and also trying to set a small architecture to my project.

i want to set my components like this:

pages/
  componentName/
     index.vue
     componentName.ts
     componentName.scss

the issue is when nuxt generate routes, i got:

/componentName 
/componentName/componentName

and the second route based on .ts file, i did change my .ts file to see if there's any changes, and yes the second componentName changes to match .ts file name.

and i don't know how to to ignore .ts files when nuxt generating routes.

Thanks

2 Answers

Put all routes in ignore property of your Nuxt config file. It is the best way to define all ignored routes in one place without renaming page-files or creating extra .ignore.

// nuxt.config.js
ignore: [
    'pages/admin/*.vue',
    'pages/settings/*.vue',
    'pages/*.ts,
    '**/*.spec.*'
]
Related