Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter option with map results in error #59

Closed
manastalukdar opened this issue Apr 29, 2019 — with CMTY · 1 comment

Comments

Copy link

commented Apr 29, 2019 — with CMTY

Version

1.0.0

Reproduction link

https://github.com/manastalukdar/manastalukdar.github.io

Steps to reproduce

Run "npm run nuxt-generate" from the folder website.

Results in error: Url must be a string. Received undefined

sitemap.xml does not get generated.

If I remove the filter option, everything works correctly.

Problematic code:

filter({ routes }) {
      return routes.map(route => {
        if (!route.url.endsWith('.xml') && !route.url.endsWith('/')) {
          route.url = `${route.url}/`
        }
      })
    },

I have verified that the Url has the correct value. I have also tried type casting it explicitly to String, without success.

What is expected ?

sitemap.xml gets generated and the filter option works as expected.

What is actually happening?

Results in error: Url must be a string. Received undefined

sitemap.xml does not get generated.

This bug report is available on Nuxt community (#c48)

@cmty cmty bot added the cmty:bug-report label Apr 29, 2019

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019 — with CMTY

Fixed it:

filter({ routes }) {
      return routes.map(route => {
        if (!route.url.endsWith('.xml') && !route.url.endsWith('/')) {
          route.url = `${route.url}/`
        }
        return route
      })
    },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.