Open sapphi-red opened 1 day ago
If you are on windows, can you try and use the example https://github.com/oxc-project/oxc-resolver/blob/main/examples/resolver.rs and see what's happening here.
I'm not on windows and I don't understand windows path at all :-/
dunce::canonicalize
seems to only trim \\?\
when the path is shorter than 260 chars.
https://gitlab.com/kornelski/dunce/-/blob/1ee29a83526c9f4c3618e1335f0454c878a54dcf/src/lib.rs#L176-180
On the other hand, libuv always strips \\?\
regardless of the char length.
https://github.com/libuv/libuv/blob/d4ab6fbba4669935a6bc23645372dfe4ac29ab39/src/win/fs.c#L2780-L2785
When using the path from Node.js side, it would be easier to use if \\?\
is always stripped. But I'm not sure if that is easier to use for the Rust side.
When using the path from Node.js side, it would be easier to use if
\\?\
is always stripped. But I'm not sure if that is easier to use for the Rust side.
Rust side has no preference, we can strip it if things still work.
When resolving a symlinked file that has a long path, oxc-resolver returns a DOS device path (a path starting with
\\?\
) on Windows. I expect a normal path to be returned (a path without\\?\
).Reproduction
pnpm i
node index.js
result \\?\D:\documents\GitHub\oxc-resolver-windows-long-path-dos-device-path-reproduction\node_modules\.pnpm\@vitejs+longfilename-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_pdxfg5khqstn67ymcqlkhhhflu\node_modules\@vitejs\longfilename-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\index.js