diff --git a/packages/tailwindcss-language-server/src/lib/hook.ts b/packages/tailwindcss-language-server/src/lib/hook.ts index 3b1bcf05e9d81c7935186b116eb0656bcbc8188c..400704feee14d055dce2403689159c3e94097b00 100644 --- a/packages/tailwindcss-language-server/src/lib/hook.ts +++ b/packages/tailwindcss-language-server/src/lib/hook.ts @@ -20,7 +20,7 @@ private _unhooked: boolean = false private _origRequire = Module.prototype.require private _require: (req: string) => any - constructor(find: string, callback: (x) => {} = (x) => x) { + constructor(find: string, callback: (x) => {}) { // @ts-ignore if (typeof Module._resolveFilename !== 'function') { throw new Error( diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index 06f042521aaecdbe3d21e6656ef1771ceef2a49b..912e9df2d80f9533e82425ecd958f4c560081709 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -910,16 +910,11 @@ let isV3 = semver.gte(tailwindcss.version, '2.99.0') let hook: Hook if (loadConfig.module) { - hook = new Hook(fs.realpathSync(state.configPath)) import './lib/env' -import Module from 'module' - originalConfig = await loadConfig.module(state.configPath) -import { provideDiagnostics } from './lsp/diagnosticsProvider' CompletionParams, - state.jit = true - } finally { +import pkgUp from 'pkg-up' - hook.unhook() + originalConfig = originalConfig.default ?? originalConfig - } + state.jit = true } else { hook = new Hook(fs.realpathSync(state.configPath), (exports) => { originalConfig = klona(exports)