question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed reloading Vue's nested routes

See original GitHub issue

I followed vue-router’s nested routes.

I run sirv start --cors --single on the folder.

Clicking link-by-link worked.

Reloading http://localhost:5000/user worked.

Reloading http://localhost:5000/user/123 failed.

But Sirv logged that failed request as 200.

I wonder if this issue is related with Sirv.

Thanks Luke!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
lukeedcommented, Aug 8, 2019

It’s because you have <script src="app.js"></script>

You’re allowing relative pathing to take place, which works fine when you’re on example.com/:level1 routes but will fail on any level deeper than that.

In your last example, the app.js is being looked for at http://localhost:5000/settings/app.js, which is wrong and so the application dies.

Change your script to <script src="/app.js"></script> and it will work, since it’s an absolute path and will always resolve from the root and not from where you currently are.

2reactions
lukeedcommented, Aug 8, 2019

Same as #33

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue-router nested route not loading my component page
I am using Vue-router and I was needing to use a nested route, so what I did I wrote Children Key word to...
Read more >
when using Nested Routes, hot-reload is not working, child ...
it's my vue.config.js's problem, I find it. All reactions.
Read more >
[Passing props to the nested routes] : Fail to work correctly ...
Hi, I'm currently learning nested routes in vuejs. When links are clicked, pages loaded and routing mechanism works.
Read more >
Using Vue 3's Router in Practice - Daily.dev
Nested Routes. With nested routes, you can dynamically load components. Besides, it also fits quite well with the Vue.js component structure.
Read more >
vue router refresh page not found - You.com | The AI Search ...
I'am getting error "404 Not found" when i refresh any page in my Vue JS ... with nested routes and parameters, and it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found