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
Based on the spec, I would not expect the first require.resolve call to succeed.
The important line is c. LOAD_AS_FILE(M) at the end of LOAD_AS_DIRECTORY step 1.
It appears to not be LOAD_AS_FILE because m/main/index.js is loaded, but not LOAD_AS_DIRECTORY either because m2/main/main2.js is not loaded (i.e., package.json is not looked up recursively).
This is relevant because we want to follow the node module-resolution spec in our own module loader; but we also want it to work for a real packages like common-tags, which specifies the lib directory for its main. See microsoft/TypeScript#12198.
The text was updated successfully, but these errors were encountered:
To reproduce
a.js
m/package.json
*m/main/index.js
(empty file)
m2/package.json
m2/main/package.json
m2/main/main2.js
(empty file)
When I run this, I get:
Explanation
Based on the spec, I would not expect the first
require.resolve
call to succeed.The important line is
c. LOAD_AS_FILE(M)
at the end of LOAD_AS_DIRECTORY step 1.It appears to not be
LOAD_AS_FILE
becausem/main/index.js
is loaded, but notLOAD_AS_DIRECTORY
either becausem2/main/main2.js
is not loaded (i.e., package.json is not looked up recursively).This is relevant because we want to follow the node module-resolution spec in our own module loader; but we also want it to work for a real packages like
common-tags
, which specifies thelib
directory for itsmain
. See microsoft/TypeScript#12198.The text was updated successfully, but these errors were encountered: