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
resolve result is inconsistent with require.resolve if windows virtual drive is used #283
The result is the same for v1.22.0 and v2.0.0-next.3.
The preserveSymlinks option is set explicitly in script to ensure that it is false.
I have added the index.js.link file to the test (via mklink). Result for it is inconsistent too:
As I see native functions were introduced to improve performance (#217).
If there is not another reason and there are performance tests I can compare realpath vs realpath.native.
Activity
ljharb commentedon May 20, 2022
Which version of resolve are you using? v1 is "latest", but there's a v2 prerelease that's worth trying as well.
It's possible that the
preserveSymlinksoption (which v2 changes the default of) is the difference you're seeing.pos777 commentedon May 20, 2022
The result is the same for v1.22.0 and v2.0.0-next.3.
The
preserveSymlinksoption is set explicitly in script to ensure that it isfalse.I have added the
index.js.linkfile to the test (via mklink). Result for it is inconsistent too:v1.22.0
v2.0.0-next.3
pos777 commentedon May 21, 2022
It seems that the
fs.realpathSync.nativeand thefs.realpath.nativefunctions cause the behavior:resolve/lib/sync.js
Line 9 in 4e183d7
resolve/lib/async.js
Line 9 in 4e183d7
Node's loader uses the
fs.realpathSyncif I look at correct place:https://github.com/nodejs/node/blob/26846a05e2ac232742e6a0bfaa7baac5e86a015b/lib/internal/modules/cjs/loader.js#L394-L398
In the test scenario these functions give the following result:
As I see
nativefunctions were introduced to improve performance (#217).If there is not another reason and there are performance tests I can compare
realpathvsrealpath.native.ljharb commentedon May 21, 2022
If the native function gives the wrong answer on windows, then we could certainly avoid using it only on windows.
ljharb commentedon May 31, 2022
Fixed by #284.
pos777 commentedon Jun 2, 2022
@ljharb, thank you! Is it possible to publish a new patch (v1.22.1) with the fix?
ljharb commentedon Jun 2, 2022
I will do so this week.
pos777 commentedon Jun 9, 2022
Hello @ljharb, any updates?
ljharb commentedon Jun 17, 2022
v1.22.1 is released.