vite-ssr icon indicating copy to clipboard operation
vite-ssr copied to clipboard

[Vue Router warn] No match found for [...] '/node_modules/.vite/chunk...'

Open m4rvr opened this issue 3 years ago • 6 comments

vite-ssr v0.10.6 vue-router v4.0.10 vite v2.3.8

Sometimes I'm getting following messages in the console when the server (dev & production) is running:

[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-YSFGVYJQ.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-WM2BNGP4.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-AU43JL3D.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-AJTGOAVB.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-YSFGVYJQ.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-WM2BNGP4.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-AU43JL3D.js?v=7feddd3a"
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-AJTGOAVB.js?v=7feddd3a"

Any idea where this is coming from since the router is configured by vite-ssr? I'm using vite-plugin-pages for the routes.

EDIT 1: Not sure what caused this but it's gone after reinstalling all dependencies.

EDIT 2: Happens again for me over and over again when starting the development server. 😕

m4rvr avatar Jun 26 '21 17:06 m4rvr

Hi! I haven't seen this error before. Can you provide a small repro? Does it also happen without SSR? (with vite dev instead of vite-ssr dev)

frandiox avatar Jul 04 '21 15:07 frandiox

@frandiox I just checked the issue again and it only happens when new dependencies were found. If I run vite-ssr it always finds new dependencies, even if vite has already detected and cached them. When I run vite (non-ssr mode) it detects those dependencies again but after that running vite-ssr works fine. Can you somehow check that or do you know why this happens, does vite-ssr not registers the new dependencies correctly?

Otherwise I will create a small repro for it to check. 😊

m4rvr avatar Jul 20 '21 12:07 m4rvr

@MarvinRudolph vite-ssr is just calling vite internally after adding a plugin and a couple of environment variables, so it shouldn't be interfering with Vite's logic too much. A small repro would definitely be helpful!

frandiox avatar Jul 26 '21 11:07 frandiox

Yup, I am seeing the similar warning too. It also outputs "unrestricted file system access" message before this warning:

Unrestricted file system access to "/node_modules/.vite/chunk-2NVDVNTV.js"
For security concerns, accessing files outside of serving allow list will be restricted by default in the future version of Vite. Refer to https://vitejs.dev/config/#server-fs-allow for more details.
[Vue Router warn]: No match found for location with path "/node_modules/.vite/chunk-2NVDVNTV.js?v=1314ab95"

I.e. it creates the cache itself and then swears at it :)

It's hard to say where this issue comes from. I couldn't get it from vite yet, only vite-ssr. But I am not sure.

plashenkov avatar Oct 14 '21 18:10 plashenkov

@plashenkov The "unrestricted file system access" is a check added in a recent version of Vite, where you can't read any file outside of your root project. If your code is similar to the examples of this repo, where projects import API mocks from outside, you'll need to add extra config.

Other than that, I'm not able to reproduce that Vue Router warning 🤔

frandiox avatar Oct 15 '21 16:10 frandiox

Hi @frandiox!

Yes, I understand that this is Vite's check. My project imports nothing from outside, it is intentionally simple for now — just one page, no API calls.

I guess it creates a cache in node_modules/.vite folder, then later it tries to load something from it and shows this message — maybe because node_modules/.vite is outside of my src folder? My index.html points to src/app.js.

Other than that, I'm not able to reproduce that Vue Router warning

The only one page in my project uses a dynamic import:

export default [
  {path: '/', component: () => import('src/pages/MainPage.vue')},
]

Maybe this is the main nuance. And I get this error not every time, but from time to time. Also, I think that it may be important not to use the --force flag. I am not sure though.

plashenkov avatar Oct 15 '21 18:10 plashenkov