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

[Bug Report] Breaks when you have extendRoutes defined #52

Closed
martinrisseeuw opened this issue Mar 22, 2018 · 6 comments
Closed

[Bug Report] Breaks when you have extendRoutes defined #52

martinrisseeuw opened this issue Mar 22, 2018 · 6 comments

Comments

@martinrisseeuw
Copy link

martinrisseeuw commented Mar 22, 2018

First of all great plugin! I found a bug when you define extendRoutes (https://nuxtjs.org/api/configuration-router/#extendroutes) the Nuxt app breaks because of the module. The error it returns in the terminal is as follow:

TypeError: Cannot read property 'replace' of undefined

  - routes.js:42 locales.forEach
    [secrid-nuxt]/[nuxt-i18n]/lib/routes.js:42:40

  - Array.forEach

  - routes.js:39 localizedRoutes.forEach.baseRoute
    [secrid-nuxt]/[nuxt-i18n]/lib/routes.js:39:13

  - Array.forEach

  - routes.js:38 generateRoutes
    [secrid-nuxt]/[nuxt-i18n]/lib/routes.js:38:19

  - module.js:23 Object.extendRoutes
    [secrid-nuxt]/[nuxt-i18n]/lib/module.js:23:23

  - utils.js:119 Object.extendRoutes
    [secrid-nuxt]/[nuxt]/lib/common/utils.js:119:23

  - builder.js:347 Builder.generateRoutesAndFiles
    [secrid-nuxt]/[nuxt]/lib/builder/builder.js:347:50

I created a gist with my Nuxt config: https://gist.github.com/martinrisseeuw/e1ffea12757710c4ff94ef1d95f5cf4b

Do you maybe have a solution or workaround that I can use the module?

This question is available on Nuxt.js community (#c25)
@paulgv paulgv closed this as completed in 0969229 Mar 26, 2018
@paulgv
Copy link
Collaborator

paulgv commented Mar 26, 2018

Hi @martinrisseeuw, thanks for reporting this! This issue should be fixed in v2.9.1, hope you can give it a try!

@martinrisseeuw
Copy link
Author

@paulgv Great it works. Thanks a lot!

@martinrisseeuw
Copy link
Author

martinrisseeuw commented Jun 27, 2018

@paulgv I have updated the library to 4.0.1 because I wanted to have the custom routes functionality within page components. Unfortunately it looks like that this fix is broken? It seems that extendRoutes in my nuxt.config are ignored. Have you experienced this issue before and have a solution for it? If not I can go back to v2.9.1 and add the routing in the module settings.

@ribrewguy
Copy link

I can confirm that this is broken on v4.1.0. I receive the error:

[1]   TypeError: Cannot read property 'replace' of undefined
[1]
[1]   - utils.js:38 getPageOptions
[1]     [nuxt-test]/[nuxt-i18n]/src/helpers/utils.js:38:37
[1]
[1]   - routes.js:28 buildLocalizedRoutes
[1]     [nuxt-test]/[nuxt-i18n]/src/helpers/routes.js:28:21
[1]
[1]   - routes.js:105 makeRoutes
[1]     [nuxt-test]/[nuxt-i18n]/src/helpers/routes.js:105:46
[1]
[1]   - module.js:60 Object.extendRoutes
[1]     [nuxt-test]/[nuxt-i18n]/src/module.js:60:29
[1]
[1]   - utils.js:119 Object.extendRoutes
[1]     [nuxt-test]/[nuxt]/lib/common/utils.js:119:23
[1]
[1]   - builder.js:347 Builder.generateRoutesAndFiles
[1]     [nuxt-test]/[nuxt]/lib/builder/builder.js:347:50

paulgv added a commit that referenced this issue Aug 9, 2018
This reapplies fix from v2.9.1 which fixes *TypeError: Cannot read property 'replace' of undefined*
when `extendRoutes` is defined in Nuxt's config

Fixes #52
@paulgv
Copy link
Collaborator

paulgv commented Aug 9, 2018

Hi guys, sorry about that, looks like the original fix was lost at some point. I re-applied it and released it in version v5.0.1

@ghost
Copy link

ghost commented Aug 9, 2018

This bug-report has been fixed by @paulgv in release v5.0.1.

@ghost ghost added the cmty:status:fixed label Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants