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

Better error message for exports-only packages #2352

Open
arty-name opened this issue Jan 13, 2022 · 5 comments
Open

Better error message for exports-only packages #2352

arty-name opened this issue Jan 13, 2022 · 5 comments

Comments

@arty-name
Copy link

I have seen in several places here (#2293, #2331, #2319 (comment)) that the support for exports-only dependencies is missing, and might not be added. The error message Unable to resolve path to module 'got'. does not do a good job to explain that. Would it be possible to handle this case better by providing a custom error message?

It would also be nice to have the project’s position on such dependencies to be explicitly stated somewhere in readme, or the support for it tracked in some "official" issue.

@ljharb
Copy link
Member

ljharb commented Jan 13, 2022

"might not be added" is objectively false; it absolutely will be added, with 100% certainty. The only unknown is the timeframe. I have stated as such (the word "yet" is important) in all of those issues you linked.

I'm not sure what better error message would be possible without actually having support in the first place.

@arty-name
Copy link
Author

Sorry for misunderstanding, I guess "it’s designed for use with CJS" left this impression on me.

Naively I would have tried, whenever the no-unresolved error is found, to see at least whether require.resolve still works for this module, which probably would indicate an uncertain situation. But I am far from an expert on this topic and on the implementation.

@ljharb
Copy link
Member

ljharb commented Jan 13, 2022

I suppose that's something the node resolver could try to do, in the event that resolve fails on a package specifier.

@arty-name
Copy link
Author

@ljharb
Copy link
Member

ljharb commented Nov 2, 2022

If you're using typescript, you should be using that resolver regardless - and if not, you likely shouldn't be either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants