Set ERR_PACKAGE_PATH_NOT_EXPORTED code on errors when bailing
See original GitHub issueNode 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 set error.code
to ERR_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:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Error [ERR_PACKAGE_PATH_NOT_EXPORTED] #142 - GitHub
I keep on getting this error since I installed this module yesterday Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in ...
Read more >Ask Question - Stack Overflow
I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports ...
Read more >suppress bailing out and force the solver to continue
Hi,. I understand that ampl/cplex discards the values of parameters if they are outside of the subscript ranges of the parameters, and return...
Read more >[err_package_path_not_exported]: package subpath './types ...
This problem can be occur when you are trying to work with an old react repository which is developed with a lower node.js...
Read more >No "exports" main defined - Laracasts
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined ... <anonymous> (C:\Users\standarduser\code\irp-project\node_modules\@babel\preset-env\lib\ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
resolve()
throws an error for some other reason (malformed map key, invalid path value, etc).For a library, it’d be preferable to avoid subclassing Error though. Just something like
Object.assign(Error('xyz'), { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' })
feels like enough.Thanks! Right, I would just add a
code
key instead of throwing custom error types.@paul-soporan already raised #5 for throwing on invalid target(s), but I don’t think
resolve()
is the right time/place for that. I don’t see this as an"exports"
validator utility.