mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 16:52:08 +01:00
fix: resolve dev server static asset warnings and 404 errors
- Remove unnecessary nonce warnings for static assets - Update middleware to properly skip static file processing - Fix unused variable error in catch block - Eliminate console spam during development
This commit is contained in:
@ -8,19 +8,12 @@ export async function getNonce(): Promise<string | undefined> {
|
||||
const headersList = await headers();
|
||||
const nonce = headersList.get("X-Nonce");
|
||||
|
||||
// Log for debugging hydration issues
|
||||
if (!nonce && process.env.NODE_ENV === "development") {
|
||||
console.warn(
|
||||
"No nonce found in headers - this may cause hydration mismatches"
|
||||
);
|
||||
}
|
||||
|
||||
// Don't warn about missing nonce as it's expected for static assets
|
||||
// The middleware only adds nonce for non-static routes
|
||||
return nonce || undefined;
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// Headers not available (e.g., in client-side code)
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.warn("Failed to get headers for nonce:", error);
|
||||
}
|
||||
// This is expected and not an error
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user