1
- // https://github.com/tailwindlabs/tailwindcss/blob/e046a37dbc17f163b066cd34a559e7c8a276bd8b /src/lib/getModuleDependencies.js
1
+ // https://github.com/tailwindlabs/tailwindcss/blob/bac5ecf0040aa9a788d1b22d706506146ee831ff /src/lib/getModuleDependencies.js
2
2
import fs from 'fs'
3
3
import path from 'path'
4
4
import normalizePath from 'normalize-path'
@@ -42,10 +42,9 @@ function resolveWithExtension(file: string, extensions: string[]): string | null
42
42
function * _getModuleDependencies (
43
43
filename : string ,
44
44
base : string ,
45
- seen : Set < string >
45
+ seen : Set < string > ,
46
+ ext = path . extname ( filename )
46
47
) : Generator < string > {
47
- let ext = path . extname ( filename )
48
-
49
48
// Try to find the file
50
49
let absoluteFile = resolveWithExtension (
51
50
path . resolve ( base , filename ) ,
@@ -62,6 +61,7 @@ function* _getModuleDependencies(
62
61
63
62
// Resolve new base for new imports/requires
64
63
base = path . dirname ( absoluteFile )
64
+ ext = path . extname ( absoluteFile )
65
65
66
66
let contents = fs . readFileSync ( absoluteFile , 'utf-8' )
67
67
@@ -74,7 +74,7 @@ function* _getModuleDependencies(
74
74
// Bail out if it's not a relative file
75
75
if ( ! match [ 1 ] . startsWith ( '.' ) ) continue
76
76
77
- yield * _getModuleDependencies ( match [ 1 ] , base , seen )
77
+ yield * _getModuleDependencies ( match [ 1 ] , base , seen , ext )
78
78
}
79
79
}
80
80
0 commit comments