Skip to content

Commit 6b825de

Browse files
committed
fix: fix windows compatibility of fileExistsWithCaseSync
1 parent a570ba0 commit 6b825de

File tree

1 file changed

+3
-3
lines changed
  • packages/@vue/cli-service-global/lib

1 file changed

+3
-3
lines changed

packages/@vue/cli-service-global/lib/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ exports.toPlugin = id => ({ id, apply: require(id) })
66
// Based on https://stackoverflow.com/questions/27367261/check-if-file-exists-case-sensitive
77
// Case checking is required, to avoid errors raised by case-sensitive-paths-webpack-plugin
88
function fileExistsWithCaseSync (filepath) {
9-
const dir = path.dirname(filepath)
9+
const { base, dir, root } = path.parse(filepath)
1010

11-
if (dir === '/' || dir === '.') {
11+
if (dir === root || dir === '.') {
1212
return true
1313
}
1414

1515
try {
1616
const filenames = fs.readdirSync(dir)
17-
if (!filenames.includes(path.basename(filepath))) {
17+
if (!filenames.includes(base)) {
1818
return false
1919
}
2020
} catch (e) {

0 commit comments

Comments
 (0)