Skip to content

Fix server not launching on older versions of VSCode #998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/tailwindcss-language-server/src/lib/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Module from 'node:module'
import { isBuiltin } from 'node:module'
import * as path from 'node:path'
import resolveFrom from '../util/resolveFrom'

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

let oldResolveFilename = (Module as any)._resolveFilename

function isBuiltin(id: string) {
// Node 16.17+, v18.6.0+, >= v20
// VSCode >= 1.78
if ('isBuiltin' in Module) {
return Module.isBuiltin(id)
}

// Older versions of Node and VSCode
// @ts-ignore
return Module.builtinModules.includes(id.replace(/^node:/, ''))
}

;(Module as any)._resolveFilename = (id: any, parent: any) => {
if (typeof id === 'string' && isBuiltin(id)) {
return oldResolveFilename(id, parent)
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-tailwindcss/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Prerelease

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

## 0.12.1

Expand Down