Skip to content

Commit fdc64cf

Browse files
committed
Fix getModuleDependencies
tailwindlabs/tailwindcss@439fdad
1 parent d14c81f commit fdc64cf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/tailwindcss-language-server/src/util/getModuleDependencies.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// https://github.com/tailwindlabs/tailwindcss/blob/e046a37dbc17f163b066cd34a559e7c8a276bd8b/src/lib/getModuleDependencies.js
1+
// https://github.com/tailwindlabs/tailwindcss/blob/bac5ecf0040aa9a788d1b22d706506146ee831ff/src/lib/getModuleDependencies.js
22
import fs from 'fs'
33
import path from 'path'
44
import normalizePath from 'normalize-path'
@@ -42,10 +42,9 @@ function resolveWithExtension(file: string, extensions: string[]): string | null
4242
function* _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

Comments
 (0)