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(ext/node): attach error code when require fails on package exports #26631

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nathanwhit
Copy link
Member

Part of #26404

storybook relies on the code property being set on ERR_PACKAGE_PATH_NOT_EXPORTED errors (they use resolve to locate files, and just ignore ERR_PACKAGE_PATH_NOT_EXPORTED errors). As the todo comment says, ideally we would just attach the code property on the rust side, but we lack the infrastructure for this currently. We already format the error message with the code at the beginning [ERR_PACKAGE_PATH_NOT_EXPORTED] ..., so as a quick and dirty solution just extract this and attach the code property to the error object.

@nathanwhit nathanwhit force-pushed the require-exports-error-code branch from c3b690b to d6e3c65 Compare October 30, 2024 04:16
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.

Maybe a little test could be added?

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.

2 participants