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(node): better detection for when to surface node resolution errors #24653

Merged
merged 10 commits into from
Jul 24, 2024

Conversation

dsherret
Copy link
Member

No description provided.

@@ -0,0 +1,2 @@
error: [ERR_MODULE_NOT_FOUND] Cannot find module 'file:///[WILDLINE]/node_modules/package/index.js' imported from 'file:///[WILDLINE]/bad_import.ts'
at file:///[WILDLINE]/bad_import.ts:1:16
Copy link
Member Author

@dsherret dsherret Jul 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now get node resolution errors here. This demonstrates a simple case, but imagine if this was something like exports not being resolved or the like. One issue is that the imported from '...' is repetitive because deno graph provides this information. We may want to consider removing the referrer from error messages and then only adding it when necesasry (ex. when importing esm with require)

Before:

error: Cannot find "package"
    at file:///V:/deno/tests/specs/node/byonm_phantom_dep_res_failure/bad_import.ts:1:16

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine for this pass 👍

@dsherret dsherret changed the title refactor: better detection for when to surface node resolution errors fix(node): better detection for when to surface node resolution errors Jul 20, 2024
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

concat!(
"Could not resolve \"{}\", but found it in a package.json. ",
"Deno expects the node_modules/ directory to be up to date. ",
"Did you forget to run `npm install`?"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention DENO_FUTURE=1 deno install here as well, as per the Slack thread

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's land in a separate pr.

@@ -0,0 +1,2 @@
error: [ERR_MODULE_NOT_FOUND] Cannot find module 'file:///[WILDLINE]/node_modules/package/index.js' imported from 'file:///[WILDLINE]/bad_import.ts'
at file:///[WILDLINE]/bad_import.ts:1:16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine for this pass 👍

@dsherret dsherret enabled auto-merge (squash) July 23, 2024 23:47
@dsherret dsherret merged commit 52ababc into denoland:main Jul 24, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants