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

fix: [vite-plugin-hot] Failed to import "/@vite/client" when using nuxt.config "app/buildAssetsDir" #384

Closed
edgarrroussille opened this issue Aug 10, 2023 · 7 comments · Fixed by #386
Labels
bug Something isn't working

Comments

@edgarrroussille
Copy link

🐛 The bug

Nuxt devtools doesn't load and console throws some errors, especially the [vite-plugin-hot] Failed to import "/@vite/client" one. Even after this commit.

We're using a custom value for buildAssetsDir.

Solution: when commenting out this buildAssetsDir, everything works. So maybe just getting that value from config when loading the Vite client ?

🛠️ To reproduce

https://stackblitz.com/edit/github-cwjhut?file=nuxt.config.ts

🌈 Expected behavior

Devtools should load even when using a custom buildAssetsDir path

ℹ️ Additional context

No response

@edgarrroussille edgarrroussille added the bug Something isn't working label Aug 10, 2023
@arashsheyda
Copy link
Member

Hey @edgarrroussille, what version of devtools are you using? It should be fixed in the latest version #375

@cuebit
Copy link
Contributor

cuebit commented Aug 10, 2023

@arashsheyda I'm encountering the same issue even on edge release that implements #375. I still observe the following error:

http://localhost:5314/_nuxt/@vite/client net::ERR_ABORTED 404 (Page Not Found: /_nuxt/@vite/client)

It appears window.__NUXT__.config evaluates to the following at the point of connection:

{
    "baseURL": "/__nuxt_devtools__/client",
    "buildAssetsDir": "/_nuxt/",
    "cdnURL": ""
}

Yet evaluating the config in the browser equates to:

{
    "baseURL": "/",
    "buildAssetsDir": "/customdir/",
    "cdnURL": ""
}

@edgarrroussille
Copy link
Author

Hey @arashsheyda I'm using v0.7.6, same as in repro link

@arashsheyda
Copy link
Member

Aww I found the problem, I will open PR as soon as possible. thanks

@cuebit
Copy link
Contributor

cuebit commented Aug 10, 2023

Aww I found the problem, I will open PR as soon as possible. thanks

Is it related to the window context? Perhaps the config is referring to the devtools window rather than the parent?

@arashsheyda
Copy link
Member

arashsheyda commented Aug 10, 2023

Is it related to the window context? Perhaps the config is referring to the devtools window rather than the parent?

exactly! PR welcome if you want

@cuebit
Copy link
Contributor

cuebit commented Aug 10, 2023

Is it related to the window context? Perhaps the config is referring to the devtools window rather than the parent?

exactly! PR welcome if you want

Happy to spin up a PR later today 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants