0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Prevent tailwind config errors from crashing dev server (#5270)

* Prevent tailwind config errors from crashing dev server

* Adding a changeset

* Fix wrong type
This commit is contained in:
Matthew Phillips 2022-11-01 10:50:53 -04:00 committed by GitHub
parent 63a3282f81
commit bb6e880009
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/tailwind': patch
---
Prevent errors during HMR from crashing dev server

View file

@ -40,13 +40,14 @@ async function getUserConfig(root: URL, configPath?: string, isRestart = false)
const tempConfigPath = path.join(dir, `.temp.${Date.now()}.${base}`);
await fs.copyFile(resolvedConfigPath, tempConfigPath);
const result = await load('tailwind', {
mustExist: false,
cwd: resolvedRoot,
filePath: tempConfigPath,
});
let result: load.Config<Record<any, any>> | undefined;
try {
result = await load('tailwind', {
mustExist: false,
cwd: resolvedRoot,
filePath: tempConfigPath,
});
await fs.unlink(tempConfigPath);
} catch {
/** file already removed */