@@ -6,7 +6,7 @@ import assign from 'object-assign'
6
6
import fs from 'fs'
7
7
import { dirname , basename , join } from 'path'
8
8
9
- export const CASE_INSENSITIVE = fs . existsSync ( join ( __dirname , 'reSOLVE.js' ) )
9
+ export const CASE_SENSITIVE_FS = ! fs . existsSync ( join ( __dirname , 'reSOLVE.js' ) )
10
10
11
11
const fileExistsCache = new Map ( )
12
12
@@ -26,6 +26,12 @@ function checkCache(cacheKey, { lifetime }) {
26
26
27
27
// http://stackoverflow.com/a/27382838
28
28
function fileExistsWithCaseSync ( filepath , cacheSettings ) {
29
+ // don't care if the FS is case-sensitive
30
+ if ( CASE_SENSITIVE_FS ) return true
31
+
32
+ // null means it resolved to a builtin
33
+ if ( filepath === null ) return true
34
+
29
35
const dir = dirname ( filepath )
30
36
31
37
let result = checkCache ( filepath , cacheSettings )
@@ -105,7 +111,7 @@ export function relative(modulePath, sourceFile, settings) {
105
111
let { path : fullPath , found } = withResolver ( resolver , config )
106
112
107
113
// resolvers imply file existence, this double-check just ensures the case matches
108
- if ( found && CASE_INSENSITIVE && fullPath !== null && ! fileExistsWithCaseSync ( fullPath , cacheSettings ) ) {
114
+ if ( found && ! fileExistsWithCaseSync ( fullPath , cacheSettings ) ) {
109
115
// reject resolved path
110
116
fullPath = undefined
111
117
}
0 commit comments