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

Deno + Vite: cannot resolve deno dependencies #26319

Open
WerdoxDev opened this issue Oct 16, 2024 · 7 comments
Open

Deno + Vite: cannot resolve deno dependencies #26319

WerdoxDev opened this issue Oct 16, 2024 · 7 comments
Labels
bug Something isn't working correctly bundler-resolution Issues caused by bundlers not supporting Deno resolution

Comments

@WerdoxDev
Copy link

Version: Deno 2.0.0 & Deno 2.0.0-f94cdd1

I have followed both docs on creating a vite app with react:

Both tutorials work until you add a package. for example @std/text from jsr.
The first one uses a third-party vite template which fully uses a deno.json file.
The second one simply uses the package.json.

If the package is added through deno.json, It kind of gets the mod.ts file of the package and nothing more. so it prints an error pointing to the first export * from "..." line. in this case for @std/text it's the levenshtein_distance.ts file.

And if the package is added through package.json, it simply fails with Failed to resolve "package"

I'm even using the deno's official deno-vite-plugin which should resolve jsr, node, https packages. But one thing I noticed is that inside the code some of the types have V1 in their name which may indicate the package is not updated for version 2.0.0 here

Here is a reproduction repo using the deno.json method: https://github.com/WerdoxDev/deno-vite-bug

@marvinhagemeister
Copy link
Contributor

I noticed is that inside the code some of the types have V1 in their name which may indicate the package is not updated for version 2.0.0 here

FYI: The format of the output of deno info --json hasn't changed with Deno 2. That version you linked there is not related to the Deno version itself.

@nathanwhit
Copy link
Member

nathanwhit commented Oct 16, 2024

I can't seem to reproduce the issue in the repo that's linked, it runs without errors on my machine (macOS). What OS are you using?

@satyarohith satyarohith added the needs info needs further information to be properly triaged label Oct 16, 2024
@WerdoxDev
Copy link
Author

I'm on windows 11

@WerdoxDev
Copy link
Author

For more info, here is the full error I get from a clean clone of the repo
image

@marvinhagemeister
Copy link
Contributor

That sounds like the same error as in #26343

@WerdoxDev
Copy link
Author

That sounds like the same error as in #26343

Nope, Just downgraded to 2.0.0. The BadResource error goes away but the main issue is still there.
image

@marvinhagemeister marvinhagemeister added bug Something isn't working correctly bundler-resolution Issues caused by bundlers not supporting Deno resolution and removed needs info needs further information to be properly triaged labels Oct 17, 2024
@mattgi
Copy link

mattgi commented Nov 11, 2024

@WerdoxDev did u ever get this solved? I am having the same issue. I am using a workspace with a deno api and basic vite+react app. I add all dependencies into the root deno.json imports. but get the above error from vite on the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly bundler-resolution Issues caused by bundlers not supporting Deno resolution
Projects
None yet
Development

No branches or pull requests

5 participants