Skip to content

Commit 341cb9d

Browse files
authored
fix: Always normalize relative transform paths (#2096)
1 parent 34f52c7 commit 341cb9d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

NOTICE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ under the licensing terms detailed in LICENSE:
4343
* Joe Pea <trusktr@gmail.com>
4444
* Felipe Gasper <FGasper@users.noreply.github.com>
4545
* Congcong Cai <77575210+HerrCai0907@users.noreply.github.com>
46+
* mooooooi <emwings@outlook.com>
4647

4748
Portions of this software are derived from third-party works licensed under
4849
the following terms:

cli/util/options.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ function merge(config, currentOptions, parentOptions, parentBaseDir) {
237237

238238
exports.merge = merge;
239239

240+
function normalizePath(p) {
241+
const parsed = path.parse(p);
242+
if (!parsed.root) {
243+
parsed.root = "./";
244+
}
245+
return path.format(parsed);
246+
}
247+
248+
exports.normalizePath = normalizePath;
249+
240250
const dynrequire = typeof __webpack_require__ === "function"
241251
? __non_webpack_require__
242252
: require;
@@ -247,7 +257,7 @@ function resolvePath(p, baseDir, useNodeResolution = false) {
247257
if (useNodeResolution && !p.startsWith(".")) {
248258
return dynrequire.resolve(p, { paths: [ baseDir ] });
249259
}
250-
return path.join(baseDir, p);
260+
return normalizePath(path.join(baseDir, p));
251261
}
252262

253263
exports.resolvePath = resolvePath;

0 commit comments

Comments
 (0)