tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/packages/tailwindcss-class-names/src/index.js b/packages/tailwindcss-class-names/src/index.js
index 27d2f94732afb64931d9e93a5a1d203c78c4e29c..82205d9ff907f149fddd8ac22e1d5fb3fadf001a 100644
--- a/packages/tailwindcss-class-names/src/index.js
+++ b/packages/tailwindcss-class-names/src/index.js
@@ -114,27 +114,34 @@ }
let watcher
function watch(files = []) {
- if (watcher) watcher.close()
+ unwatch()
watcher = chokidar
- .watch([CONFIG_GLOB, ...files], { cwd })
+ .watch(files, { cwd })
.on('change', handleChange)
.on('unlink', handleChange)
}
+ function unwatch() {
+ if (watcher) {
+ watcher.close()
+ }
+ }
async function handleChange() {
- const prevDeps = result ? result.dependencies : []
+ const prevDeps = result ? [result.configPath, ...result.dependencies] : []
try {
result = await run()
} catch (error) {
if (error instanceof TailwindConfigError) {
onChange({ error })
} else {
+ unwatch()
onChange(null)
}
return
}
- if (!arraysEqual(prevDeps, result.dependencies)) {
- watch(result.dependencies)
+ const newDeps = [result.configPath, ...result.dependencies]
+ if (!arraysEqual(prevDeps, newDeps)) {
+ watch(newDeps)
}
onChange(result)
}
@@ -143,11 +150,10 @@ let result
try {
result = await run()
} catch (_) {
- watch()
return null
}
- watch(result.dependencies)
+ watch([result.configPath, ...result.dependencies])
return result
}