-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
refactor(core): use require.resolve
instead of Module
internals
#5796
Conversation
require.resolve
instead of Module
internals
require.resolve
instead of Module
internalsrequire.resolve
instead of Module
internals
@pi0 I did some local testing and it seems the returned errors are different from |
@pi0 It looks like that
https://github.com/nodejs/node/blob/master/lib/internal/modules/cjs/helpers.js#L21 |
Good point @clarkdo, but I guess the main question is, does it still achieve the same thing, or is it maybe even the more correct thing to do? |
@Globegitter You're right, |
@clarkdo Yeah that is strange indeed - but at least all the tests are passing now, so that is something. In my local testing |
@Globegitter Error is from https://github.com/facebook/jest/blob/master/packages/jest-runtime/src/index.ts#L650-L654 which doesn't set code, so it only happens in jest. |
Codecov Report
@@ Coverage Diff @@
## dev #5796 +/- ##
==========================================
- Coverage 95.69% 95.66% -0.04%
==========================================
Files 82 82
Lines 2674 2676 +2
Branches 685 686 +1
==========================================
+ Hits 2559 2560 +1
- Misses 97 98 +1
Partials 18 18
Continue to review full report at Codecov.
|
require.resolve
instead of Module
internalsrequire.resolve
instead of Module
internals
Types of changes
Description
Is there any reason to not use require.resolve but rather a private module function? We use Bazel as our build tool to call nuxt and it implements a custom module resolution. Using this private method currently does not work, but using
require.resolve
does. Would be great to get this in if there is no specific reason to use this private method.Checklist: