Skip to content

Commit 413f4f1

Browse files
Fix server not launching on older versions of VSCode (#998)
* Fix loading on old versions of VSCode * Update changelog
1 parent 405502b commit 413f4f1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Module from 'node:module'
2-
import { isBuiltin } from 'node:module'
32
import * as path from 'node:path'
43
import resolveFrom from '../util/resolveFrom'
54

@@ -8,6 +7,18 @@ process.env.TAILWIND_DISABLE_TOUCH = 'true'
87

98
let oldResolveFilename = (Module as any)._resolveFilename
109

10+
function isBuiltin(id: string) {
11+
// Node 16.17+, v18.6.0+, >= v20
12+
// VSCode >= 1.78
13+
if ('isBuiltin' in Module) {
14+
return Module.isBuiltin(id)
15+
}
16+
17+
// Older versions of Node and VSCode
18+
// @ts-ignore
19+
return Module.builtinModules.includes(id.replace(/^node:/, ''))
20+
}
21+
1122
;(Module as any)._resolveFilename = (id: any, parent: any) => {
1223
if (typeof id === 'string' && isBuiltin(id)) {
1324
return oldResolveFilename(id, parent)

packages/vscode-tailwindcss/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Prerelease
44

55
- Fix loading projects on Windows network drives ([#996](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/996))
6+
- Fix server not launching on older versions of VSCode ([#998](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/998))
67

78
## 0.12.1
89

0 commit comments

Comments
 (0)