Nuxt.js: multiple named views cause router.js contains syntax error

Created on 23 Feb 2019  Â·  7Comments  Â·  Source: nuxt/nuxt.js

Version

v2.4.3

Reproduction link

https://github.com/kdeng/nuxt-named-view-sample

Steps to reproduce

  1. Run npm i
  2. Run npm run dev

What is expected ?

I expected router.js can be generated properly, and named view can be rendered properly.

What is actually happening?

router.js has been generated with syntax error.

 ERROR  Failed to compile with 1 errors                                                                                                                                                                                                                   friendly-errors 22:13:34


 ERROR  in ./.nuxt/router.js                                                                                                                                                                                                                              friendly-errors 22:13:34

Syntax Error: Unexpected token, expected "," (86:8)                                                                                                                                                                                                       friendly-errors 22:13:34

  84 |         default: _708facd7,
  85 |         footer: _03b372e3
> 86 |         default: _6fab42f0,
     |         ^
  87 |         top: _6b7085a2
  88 |       },
  89 |       name: "main"

                                                                                                                                                                                                                                                          friendly-errors 22:13:34
 @ ./.nuxt/index.js 8:0-43 59:19-31
 @ ./.nuxt/client.js
 @ multi eventsource-polyfill webpack-hot-middleware/client?reload=true&timeout=30000&ansiColors=&overlayStyles=&name=client&path=/__webpack_hmr/client ./.nuxt/client.js
                                                                                                                                                                                                                                                          friendly-errors 22:13:34
ℹ Waiting for file changes

Additional comments?

I am new to nuxtjs, and try to play around about named views for enabling master footer component for cart router, I am not sure whether it is my mistake or a bug. Cheers.

This bug report is available on Nuxt community (#c8715)
bug-report pending

Most helpful comment

@kdeng ignore my last message, 2.15 has been released, just update to the latest version and everything should be good! Let me know if it's not.

All 7 comments

Any update about this issue? Cheers

@kdeng I'm also experiencing this issue.

I might see if I can help out and find the source of this issue and submit a PR.

The named-view example does not hit this bug, suspect it happens with top level named views only.

@kdeng The issue has been discovered and a PR #5262 is going through review.

If you have a moment, could you test that branch and confirm it fixes the issue?

@leahciMic Thanks for your update.

I just checkout the repo with those changes, and it seems doesn't work as expect.

I just clone your fix, and push my changes in https://github.com/kdeng/nuxt.js/commit/b655fae06e807f9cf0826cc0a3747b7b5ffba925.

I have tried two cases yarn nuxt examples/named-views and yarn nuxt test/fixtures/named-views with no luck.

Could you please have a look on my changes? and see if I made some mistakes.

Cheers.

@kdeng I believe you have cloned my dev branch, which is woefully out of date. The branch you want to checkout is https://github.com/leahciMic/nuxt.js/tree/fix/5096.

Now I'm fairly new to lerna, and I am not sure if this is the best approach. (I would love for anyone to give wisdom here).

In wherever you've cloned my branch to, run the following:

yarn build
npx lerna link

Now navigate to packages/vue-app, and run yarn link.

Now in the repository that you are experiencing the issue on, simply type yarn link "@nuxt/vue-app". It will replace the vue-app module inside your node_modules folder with the one from my branch that you ran yarn link from.

There's probably a much easier/ better way to do this. I'm open to hearing about it.

@kdeng ignore my last message, 2.15 has been released, just update to the latest version and everything should be good! Let me know if it's not.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VincentLoy picture VincentLoy  Â·  3Comments

msudgh picture msudgh  Â·  3Comments

jaredreich picture jaredreich  Â·  3Comments

uptownhr picture uptownhr  Â·  3Comments

o-alexandrov picture o-alexandrov  Â·  3Comments