Skip to content
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
2 changes: 1 addition & 1 deletion packages/tailwindcss-language-server/src/lib/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class Hook {
private _origRequire = Module.prototype.require
private _require: (req: string) => any

constructor(find: string, callback: (x) => {}) {
constructor(find: string, callback: (x) => {} = (x) => x) {
// @ts-ignore
if (typeof Module._resolveFilename !== 'function') {
throw new Error(
Expand Down
11 changes: 8 additions & 3 deletions packages/tailwindcss-language-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,14 @@ async function createProjectService(
let hook: Hook

if (loadConfig.module) {
originalConfig = await loadConfig.module(state.configPath)
originalConfig = originalConfig.default ?? originalConfig
state.jit = true
hook = new Hook(fs.realpathSync(state.configPath))
try {
originalConfig = await loadConfig.module(state.configPath)
originalConfig = originalConfig.default ?? originalConfig
state.jit = true
} finally {
hook.unhook()
}
} else {
hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
originalConfig = klona(exports)
Expand Down