esm-module-alias icon indicating copy to clipboard operation
esm-module-alias copied to clipboard

`path.join` should not be used with `file:\\` URL

Open Moriarty47 opened this issue 2 months ago • 0 comments

path.join should not be used with file:\\ URL, it's unreliable.

// Node.js v18
const path = require('path');
path.join('file:\\', process.cwd());
// 'file:\\C:\\Users\\xxx\\nodejs\\v18.xx'

// Node.js v24
const path = require('path');
path.join('file:\\', process.cwd());
// '.\\file:\\C:\\Users\\xxx\\nodejs\\v24.xx'
    ^

Moriarty47 avatar Nov 10 '25 13:11 Moriarty47