Skip to content

Conversation

nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Aug 26, 2025

Fixes #30510

Basically we save the error for later, return None to esbuild. Later when we process esbuild errors, if esbuild failed to resolve the same package then we use our error message instead of esbuild's

Also this changes how we print out the esbuild errors to include the notes, which can often be useful

fn esbuild_resolve_error_path(
error: &esbuild_client::protocol::Message,
) -> Option<String> {
let re = lazy_regex::regex!(r#"^Could not resolve "([^"]+)"#);
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI esbuild has an API that allows you to customize the formatting of its diagnostic logs, see https://esbuild.github.io/api/#format-messages

Copy link
Member Author

@nathanwhit nathanwhit Aug 26, 2025

Choose a reason for hiding this comment

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

From my reading, that lets you give them a Message and then get back a formatted string that matches esbuild's native output formatting. Since we want to do our own output (so that it matches the rest of the CLI) I'm not sure it's useful here

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM

@nathanwhit nathanwhit merged commit 6967c6d into denoland:main Aug 27, 2025
19 checks passed
@nathanwhit nathanwhit deleted the bundle-fallible-imports branch August 27, 2025 18:30
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.

deno bundle fails with multiple [ERR_MODULE_NOT_FOUND] and [ERR_UNSUPPORTED_DIR_IMPORT] errors

3 participants