1- // https://github.com/tailwindlabs/tailwindcss/blob/e046a37dbc17f163b066cd34a559e7c8a276bd8b /src/lib/getModuleDependencies.js
1+ // https://github.com/tailwindlabs/tailwindcss/blob/bac5ecf0040aa9a788d1b22d706506146ee831ff /src/lib/getModuleDependencies.js
22import fs from 'fs'
33import path from 'path'
44import normalizePath from 'normalize-path'
@@ -42,10 +42,9 @@ function resolveWithExtension(file: string, extensions: string[]): string | null
4242function * _getModuleDependencies (
4343 filename : string ,
4444 base : string ,
45- seen : Set < string >
45+ seen : Set < string > ,
46+ ext = path . extname ( filename )
4647) : Generator < string > {
47- let ext = path . extname ( filename )
48-
4948 // Try to find the file
5049 let absoluteFile = resolveWithExtension (
5150 path . resolve ( base , filename ) ,
@@ -62,6 +61,7 @@ function* _getModuleDependencies(
6261
6362 // Resolve new base for new imports/requires
6463 base = path . dirname ( absoluteFile )
64+ ext = path . extname ( absoluteFile )
6565
6666 let contents = fs . readFileSync ( absoluteFile , 'utf-8' )
6767
@@ -74,7 +74,7 @@ function* _getModuleDependencies(
7474 // Bail out if it's not a relative file
7575 if ( ! match [ 1 ] . startsWith ( '.' ) ) continue
7676
77- yield * _getModuleDependencies ( match [ 1 ] , base , seen )
77+ yield * _getModuleDependencies ( match [ 1 ] , base , seen , ext )
7878 }
7979}
8080
0 commit comments