denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.21k stars 5.37k forks source link

Some dependencies not being resolved when using RsBuild #26091

Open sachaw opened 3 weeks ago

sachaw commented 3 weeks ago

Version: Deno 2.0.0

Hi, Take the following RsBuild + SolidJS repo running under Deno:

https://github.com/sachaw/rsbuild-issue

When running deno install, as "nodeModulesDir": "auto" is set, it is populated as follows:

image

As can be seen modules like date-fns are populated at the root level, and hence are located and compile fine under RsBuild.

Now take my next dependency: @dewars/protobufs which is published to JSR:

It is resolved by my IDE (because of the Deno plugin), but is not populated in my node_modules folder, leading RsBuild to fail to resolve it.

Ideally I can eventually ditch the whole node modules folder, so I'm hoping the solution isn't to copy all of my native deno deps under node_modules

marvinhagemeister commented 3 weeks ago

The issue is likely caused by rsbuild not understanding Deno-specific resolution.

sachaw commented 2 weeks ago

Is this not a deno responsibility (nodejs compat) or is this out of scope for some reason?

marvinhagemeister commented 2 weeks ago

Every bundler has their own resolution code and rspack/rsbuild always expects a dependency to be in the node_modules folder as it assumes that every dependency is an npm dependency. That assumption is not something we can fix on the Deno side.