Nuxt.js: Generating nested routes while trailingSlash is true

Created on 8 Oct 2020  ยท  5Comments  ยท  Source: nuxt/nuxt.js

Versions

  • nuxt: 12.14.6

Reproduction

Visit the link and inside sandbox terminal run: npm run generate
https://codesandbox.io/s/nuxt-generate-trailing-slash-bug-x7bhd?file=/nuxt.config.js

Steps to reproduce

  1. Setup nested routes https://nuxtjs.org/guide/routing#nested-routes
/pages/about.vue
/pages/about/company.vue # or /pages/about/company/index.vue
  1. Enable trailingSlash: true inside nuxt.config
  2. Run command nuxt generate to generate nested pages

What is Expected?

Success generation of nested routes containing trailing slash.

โœ” Generated route "/about/company/"
โœ” Generated route "/about/info/"  

What is actually happening?

The command is failing with error This page could not be found and missing trailing slashes on nested routes.

Note: the build actually completes without issues, just seems to be the build error.

Error generating route "/about/company": This page could not be found
Error generating route "/about/info": This page could not be found

Kapture 2020-10-08 at 17 29 37

bug-report

Most helpful comment

Yes! This is a bug! (which is actually is regression, before 2.14.0 it was working fine). Reporting this bug was on my todo list for awhile. Thanks for reporting and opening a pull request!
(With fallback set to true, those not found routes are still accessible. Or you can manually add them in routes.)
To be more accurate, the problem occurs when using nuxt-child.

All 5 comments

Can someone please help confirm this bug, and also point me in the right direction for where to fix this. Thanks :)

@cain +1 Trailing slash are needed for netflify

Yes! This is a bug! (which is actually is regression, before 2.14.0 it was working fine). Reporting this bug was on my todo list for awhile. Thanks for reporting and opening a pull request!
(With fallback set to true, those not found routes are still accessible. Or you can manually add them in routes.)
To be more accurate, the problem occurs when using nuxt-child.

This should be fixed in v2.14.8. Please reopen if not.

I've just upgraded to v.2.14.8 and my nested routes are correctly generated!๐Ÿ˜ƒ Thanks everyone for the fix!๐Ÿ‘

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msudgh picture msudgh  ยท  3Comments

surmon-china picture surmon-china  ยท  3Comments

lazycrazy picture lazycrazy  ยท  3Comments

danieloprado picture danieloprado  ยท  3Comments

gary149 picture gary149  ยท  3Comments