-
Notifications
You must be signed in to change notification settings - Fork 778
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
🐛 BUG: workerd module resolution issues ("Error: No such module") #6286
Comments
From my testing, this seems to be a bug only when using pnpm, does that seem right to you? |
it's almost like it's not following the symlinks correctly or something like that. |
It doesn't seem to be a pnpm issue for me. I just tested with npm and got the same results. It shouldn't be a symlink issue because this is happening within the dependency and it only happens when the |
Jumping in here to +1 this problem in particular. In my Cloudflare Worker project (using ...but unfortunately the import paths within @peculiar/asn1-schema/build/es2015/ that only specify
For sake of curiosity I found out I can go into node_modules/ and manually change these import paths to |
@stevezhu @davidbarratt Try updating to the latest @cloudflare/[email protected], which includes #6455 a.k.a. "fix: ensure that directory imports in commonjs modules get resolved to their index file" My index.js-related problem above has been fixed 🎉 |
Thanks! That does fix the |
@MasterKale I have done that, but still facing the same error: #5367 (comment) |
I get the same on ubuntu:
|
I'm not sure, but json the issue might be a duplicate of #6591 (I'm just mentioning it so that when we solve one we can cross check the other as well) |
Which Cloudflare product(s) does this pertain to?
Workers Vitest Integration
What version(s) of the tool(s) are you using?
3.65.0 [Wrangler], 1.20240614.0 [workerd], 0.4.12 [@cloudflare/vitest-pool-workers]
What version of Node are you using?
22.5.0
What operating system and version are you using?
Windows 11
(I also tested on MacOS, but not too thoroughly. Fairly certain this also happens there.)
Describe the Bug
Observed behavior
It seems there are issues with module resolution for dependencies with workerd.
The two issues I've seen are:
Can't resolve directory imports like below. IfUpdate: Seems to be fixed by fix: ensure that directory imports in commonjs modules get resolved to their index file #6455index.js
is added explicitly, then it works. Error logs below under "Issue 1".Expected behavior
Should be able to resolve both of these imports.
Steps to reproduce
Reproduction for issue 1: https://github.com/stevezhu/cloudflare-vitest-integration-resolution-bug
Reproduction for issue 2: https://github.com/stevezhu/cloudflare-vitest-integration-resolution-bug/tree/json-resolution-error
Steps to run
pnpm i
pnpm run test
Please provide a link to a minimal reproduction
https://github.com/stevezhu/cloudflare-vitest-integration-resolution-bug
Please provide any relevant error logs
Issue 1:
Issue 2:
The text was updated successfully, but these errors were encountered: