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:
parent
63a3282f81
commit
bb6e880009
2 changed files with 12 additions and 6 deletions
5
.changeset/long-turtles-run.md
Normal file
5
.changeset/long-turtles-run.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/tailwind': patch
|
||||
---
|
||||
|
||||
Prevent errors during HMR from crashing dev server
|
|
@ -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', {
|
||||
let result: load.Config<Record<any, any>> | undefined;
|
||||
try {
|
||||
result = await load('tailwind', {
|
||||
mustExist: false,
|
||||
cwd: resolvedRoot,
|
||||
filePath: tempConfigPath,
|
||||
});
|
||||
|
||||
try {
|
||||
await fs.unlink(tempConfigPath);
|
||||
} catch {
|
||||
/** file already removed */
|
||||
|
|
Loading…
Reference in a new issue