Skip to content

Commit 098d8b4

Browse files
authored
fix: Support windows format path (#2262) (#2279)
1 parent 010b7a9 commit 098d8b4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Diff for: cli/index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -651,17 +651,18 @@ export async function main(argv, options) {
651651

652652
// Include entry files
653653
for (let i = 0, k = argv.length; i < k; ++i) {
654-
const filename = argv[i];
655-
let sourcePath = String(filename)
656-
.replace(/\\/g, "/")
657-
.replace(extension_re, "")
658-
.replace(/[\\/]$/, "");
654+
const filename = String(argv[i]);
659655

660656
// Setting the path to relative path
661-
sourcePath = path.isAbsolute(sourcePath)
662-
? path.relative(baseDir, sourcePath).replace(/\\/g, "/")
663-
: sourcePath;
657+
let sourcePath = path.isAbsolute(filename)
658+
? path.relative(baseDir, filename)
659+
: path.normalize(filename);
664660

661+
sourcePath = sourcePath
662+
.replace(/\\/g, "/")
663+
.replace(extension_re, "")
664+
.replace(/\/$/, "");
665+
665666
// Try entryPath.ext, then entryPath/index.ext
666667
let sourceText = await readFile(sourcePath + extension, baseDir);
667668
if (sourceText == null) {

0 commit comments

Comments
 (0)