Skip to content

Commit 33f94ba

Browse files
authored
Fix use of certain built-in node modules in config file (#745)
1 parent 89dd104 commit 33f94ba

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

package-lock.json

Lines changed: 29 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tailwindcss-language-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"@types/debounce": "1.2.0",
4141
"@types/node": "14.14.34",
4242
"@types/vscode": "1.65.0",
43-
"builtin-modules": "3.2.0",
4443
"chokidar": "3.5.1",
4544
"color-name": "1.1.4",
4645
"culori": "0.20.1",
@@ -51,6 +50,7 @@
5150
"enhanced-resolve-301": "0.0.1",
5251
"fast-glob": "3.2.4",
5352
"find-up": "5.0.0",
53+
"is-builtin-module": "3.2.1",
5454
"jest": "25.5.4",
5555
"klona": "2.0.4",
5656
"license-checker": "25.0.1",

packages/tailwindcss-language-server/src/lib/env.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import Module from 'module'
22
import * as path from 'path'
33
import resolveFrom from '../util/resolveFrom'
4-
import builtInModules from 'builtin-modules'
4+
import isBuiltinModule from 'is-builtin-module'
55

66
process.env.TAILWIND_MODE = 'build'
77
process.env.TAILWIND_DISABLE_TOUCH = 'true'
88

99
let oldResolveFilename = (Module as any)._resolveFilename
1010

1111
;(Module as any)._resolveFilename = (id: any, parent: any) => {
12-
if (
13-
typeof id === 'string' &&
14-
(builtInModules.includes(id) || builtInModules.includes(id.replace(/^node:/, '')))
15-
) {
12+
if (typeof id === 'string' && isBuiltinModule(id)) {
1613
return oldResolveFilename(id, parent)
1714
}
1815
return resolveFrom(path.dirname(parent.id), id)

0 commit comments

Comments
 (0)