Closed chasegiunta closed 2 years ago
Give me a way to reproduce this, and I can try looking into it -- but I agree, it is likely an upstream issue of some sort.
Currently, I have no way to get a response from localhost:3000/@vite/client
with my vite dev server running, so if you're able with the latest version of vite (2.9.9), then you're a step ahead of me and maybe we can chalk this up to something local. Just putting it on your radar. If I figure out a way to fix/toggle it, I'll post more details.
Run this locally:
https://github.com/nystudio107/devmode
Clone it down, cd to the directory, then do:
make clean
make dev
...and see if HMR works for you as expected.
Okay, so localhost:3000/@vite/client
won't be available until your app's entry file (in my case,main.ts
) is requested from the browser first. This breaks checkDevServer => true
because trying to ping localhost:3000/@vite/client
returns 404.
Recreated by:
checkDevServer => true
localhost:3000/@vite/client
in your browser directly (both should be broke)checkDevServer
to false
localhost:3000/@vite/client
, ensure it's still inaccessible.localhost:3000/@vite/client
and the file should properly load.Okay, I think I found a fix... give me one moment...
Released as:
Craft 4: https://github.com/nystudio107/craft-vite/releases/tag/4.0.0 Craft 3: https://github.com/nystudio107/craft-vite/releases/tag/1.0.25
Describe the bug
I know this has been an issue in the past, but possibly showing up again... Vite dev server is running, and navigating to
localhost:3000/src/main.ts
shows the right file, butlocalhost:3000/@vite/client
is dead, thus dev server is not being detected as running ifcheckDevServer => true
. What makes this difficult to repro is it seems pretty spotty.Ultimately, I don't think this is an issue with craft-vite, but with vite itself, though I wonder if there's an alternative method to dev server detection.
Versions