You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
loadNodeModules() should be more clear about what went wrong #143
I had an error loading a library, but all it told me is that it couldn't resolve the module. That's fine, but the real issue is that the package's main file didn't exist.
We can definitely make this better. We can say all the directories we looked in, what exact file we;'re looking for (in this case main) and then do some reading to show the user that it's the package;'s fault.
What does require.resolve tell you in that scenario?
Why would the issue here just be "missing main"? Couldn't also Users/krainboltgreene/Code/krainboltgreene/deushack/source/client/cycle.js or Users/krainboltgreene/Code/krainboltgreene/deushack/source/client/cycle/index.js also be missing?
@ljharb Hi Jordan, this issue sounds very interesting even though it's been here for a long time. I'm wondering whether it's still opened and still recommended to work on now?
@calvinqc yes, that'd be great! Be mindful though, that changing error message text has been semver-major in the past, so I'm highly likely to only accept the PR into v2 (the default branch) and not be able to backport it into v1 (the 1.x branch).
@krainboltgreene yes, potentially - there are tools that rely on the exact string and type of an error that resolve throws in specific situations. I've broken angular-cli and ember-cli before by changing an error message, and am not anxious to repeat it.
Activity
ljharb commentedon Nov 16, 2017
What does
require.resolvetell you in that scenario?Why would the issue here just be "missing main"? Couldn't also
Users/krainboltgreene/Code/krainboltgreene/deushack/source/client/cycle.jsorUsers/krainboltgreene/Code/krainboltgreene/deushack/source/client/cycle/index.jsalso be missing?krainboltgreene commentedon Nov 16, 2017
In this case the package had a
"main": "transpiled/source/index.js"which literally didn't exist.krainboltgreene commentedon Nov 16, 2017
Three parts for improvement:
I would love to work on this as a PR.
ljharb commentedon Nov 16, 2017
I'm hesitant to add complexity, even in error paths - but if you're willing, taking a look at it via a PR would be helpful.
calvinqc commentedon Oct 27, 2020
@ljharb Hi Jordan, this issue sounds very interesting even though it's been here for a long time. I'm wondering whether it's still opened and still recommended to work on now?
ljharb commentedon Oct 27, 2020
@calvinqc yes, that'd be great! Be mindful though, that changing error message text has been semver-major in the past, so I'm highly likely to only accept the PR into v2 (the default branch) and not be able to backport it into v1 (the 1.x branch).
krainboltgreene commentedon Oct 29, 2020
Is it still breaking if you get a generic semi-related error before and now you get a specific error?
ljharb commentedon Oct 29, 2020
@krainboltgreene yes, potentially - there are tools that rely on the exact string and type of an error that resolve throws in specific situations. I've broken angular-cli and ember-cli before by changing an error message, and am not anxious to repeat it.
krainboltgreene commentedon Nov 2, 2020
As the maintainer of a big project i feel that.
[Fix] throw an error for an invalid explicit `main` with a missing `.…