-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Set ERR_PACKAGE_PATH_NOT_EXPORTED code on errors when bailing #3
Comments
Thanks, I wasn't sure where I stood on this. Introducing identical error codes might be a slippery slope that then leads to identical error messages and error stack/details – both of which I either don't want to do, or can't. Node errors are also tied to the file system, giving the filepath(s) checked as well as the parentURL. I could see adding my own error codes that differentiate the two In any event, I was hoping to reach some kind of consensus from bundlers and/or Node teams to figure out what should be done here. |
Thanks for sharing your perspective on this, I can give you my perspective on how PnP, a Node installation strategy (where I'm currently trying to implement exports support via PnP patches the Node resolution and throws more detailed errors on undeclared dependencies (and other things). Those errors have a custom message, stack, details, an Because of this, in PnP we'll need to assign the Node error code even if |
Yup, understood! I'll try to get some more eyes on this and see if there's some kind of group decision to be made here. |
I think this would be nice. Given that this package is mostly used in cli/tooling/server environments, it feels like it's worth the extra bytes. It provides for a potential future scenario where For a library, it'd be preferable to avoid subclassing Error though. Just something like |
Thanks! Right, I would just add a @paul-soporan already raised #5 for throwing on invalid target(s), but I don't think |
Node throws an
ERR_PACKAGE_PATH_NOT_EXPORTED
error when "Package exports do not define or permit a target subpath in the package for the given module".For improved compatibility with the Node ecosystem, I think it would be a good idea for
resolve.exports
to seterror.code
toERR_PACKAGE_PATH_NOT_EXPORTED
when bailing, so that packages can continue checking the error code to tell "path not exported" errors apart from other errors.Ref:
The text was updated successfully, but these errors were encountered: