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

Routes not registered when file created from code snippet via IDE on Windows #13791

Closed
Aareksio opened this issue Apr 22, 2022 · 3 comments · Fixed by nuxt/framework#5002
Closed

Comments

@Aareksio
Copy link
Contributor

Aareksio commented Apr 22, 2022

Follow-up from closed #13725, credits to OP @metamist.

Environment


  • Operating System: Windows_NT
  • Node Version: v16.13.2
  • Nuxt Version: 3.0.0-27501460.04a72f8
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: hooks
  • Runtime Modules: -
  • Build Modules: -

WebStorm 2022.1
Build #WS-221.5080.193, built on April 10, 2022

Reproduction

  1. Open minimal nuxt 3 project with pages/ directory enabled in latest WebStorm
  2. Start a dev server
  3. Create new Vue Component via snippet (test.vue)
  4. Visit http://localhost:3000/test

image

Describe the bug

File watcher does not seem to detect when file pages/test.vue is added, it only detects change. This leads to the route not being registered until dev server is restarted.

Additional context

Logs generated with @danielroe suggested:

  import { defineNuxtConfig } from 'nuxt3'

  export default defineNuxtConfig({
+   hooks: {
+     'builder:watch': console.log
+   }
  })

Opening the issue with better description and reproduction as the author from original #13725 decided to close.
While Windows specific, this is a big hindrance on Windows DX.

Logs

Reproduction:

Nuxt CLI v3.0.0-27501460.04a72f8                                                                                                                                                                             12:53:31
                                                                                                                                                                                                             12:53:31
  > Local:    http://localhost:3000/                                                                                                                                                                                 
  > Network:  http://10.5.0.2:3000/                                                                                                                                                                                  
  > Network:  http://192.168.1.101:3000/                                                                                                                                                                             

i Vite client warmed up in 1080ms                                                                                                                                                                            12:53:38
i Vite server warmed up in 532ms                                                                                                                                                                             12:53:38
√ Vite server built in 1074ms                                                                                                                                                                                12:53:39
√ Nitro built in 384 ms                                                                                                                                                                                nitro 12:53:39
change pages/test.vue                                                                                                                                                                                        12:53:55
√ Vite server built in 79ms                                                                                                                                                                                  12:53:55
add .git/objects/21/08a3b6d9acb7cac2d7c2bb7879492d405337e4                                                                                                                                                   12:53:57
change pages/test.vue                                                                                                                                                                                        12:54:06
√ Vite server built in 103ms                                                                                                                                                                                 12:54:06
change .idea/workspace.xml                                                                                                                                                                                   12:54:07
√ Vite server built in 97ms                                                                                                                                                                                  12:54:07
[Vue Router warn]: No match found for location with path "/test"
[Vue Router warn]: No match found for location with path "/test"
[Vue Router warn]: No match found for location with path "/__nuxt_error?url=/test&statusCode=404&statusMessage=Page+not+found:+/test&message=Page+not+found:+/test&description"
[Vue Router warn]: No match found for location with path "/test"                                                                                                               
Correct flow ("New > File" instead of "New > Vue Component")
Nuxt CLI v3.0.0-27501460.04a72f8                                                                                                                                                                             12:51:29
                                                                                                                                                                                                             12:51:29
  > Local:    http://localhost:3000/
  > Network:  http://10.5.0.2:3000/
  > Network:  http://192.168.1.101:3000/

i Vite client warmed up in 1029ms                                                                                                                                                                            12:51:36
i Vite server warmed up in 575ms                                                                                                                                                                             12:51:36
√ Vite server built in 1126ms                                                                                                                                                                                12:51:37
√ Nitro built in 373 ms                                                                                                                                                                                nitro 12:51:37
add pages/test.vue                                                                                                                                                                                           12:51:47

 WARN  Duplicated imports "definePageMeta", the one from "X:/_polygon/nuxt3-issues/node_modules/nuxt3/dist/pages/runtime/composables" has been ignored                                                       12:51:47

√ Vite server built in 151ms                                                                                                                                                                                 12:51:47
√ Vite server built in 71ms                                                                                                                                                                                  12:51:47
change .git/index                                                                                                                                                                                            12:51:48
change pages/test.vue                                                                                                                                                                                        12:51:58
√ Vite server built in 114ms                                                                                                                                                                                 12:51:58
change .idea/workspace.xml                                                                                                                                                                                   12:51:58
√ Vite server built in 77ms                                                                                                                                                                                  12:51:58
@danielroe
Copy link
Member

danielroe commented Apr 22, 2022

Thanks for opening. Does it make a difference if you enable usePolling? (This would not be the fix, just a debugging step.)

#12822

@Aareksio
Copy link
Contributor Author

Aareksio commented Apr 22, 2022

import { defineNuxtConfig } from 'nuxt3';

export default defineNuxtConfig({
  hooks: {
    'builder:watch': console.log,
  },
+ vite: {
+   server: {
+     watch: {
+       usePolling: true
+     }
+   }
+ }
});

No changes, 3 attempts failed:

Log
Nuxt CLI v3.0.0-27501460.04a72f8                                                                    10:53:24
                                                                                                    10:53:24
  > Local:    http://localhost:3000/                                                                        
  > Network:  http://10.5.0.2:3000/
  > Network:  http://192.168.1.101:3000/

i Vite client warmed up in 1070ms                                                                   10:53:30
i Vite server warmed up in 534ms                                                                    10:53:31
√ Vite server built in 1090ms                                                                       10:53:31
√ Nitro built in 376 ms                                                                       nitro 10:53:32
change pages/test.vue                                                                               10:53:51
√ Vite server built in 89ms                                                                         10:53:51
change .git/index                                                                                   10:53:52
change pages/test.vue                                                                               10:53:56
change .idea/workspace.xml                                                                          10:53:56
√ Vite server built in 88ms                                                                         10:53:56
√ Vite server built in 71ms                                                                         10:53:56
[Vue Router warn]: No match found for location with path "/test"
[Vue Router warn]: No match found for location with path "/test"
[Vue Router warn]: No match found for location with path "/__nuxt_error?url=/test&statusCode=404&statusMessage
=Page+not+found:+/test&message=Page+not+found:+/test&description"
[Vue Router warn]: No match found for location with path "/test"

From my very limited experience of serious computer stuff, file watchers on Windows are tricky, the homemade solution one of my co-workers came up with similar issue in JustArchiNET/ArchiSteamFarm was to ignore change emitted less than 500ms after create.


Apparently the events on Windows can also come in wrong order, change before create 😅

@aovol
Copy link

aovol commented May 5, 2022

still not working, it's annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants