From f89ded9ae8f59ee7f09634e49ad1f98ef567f3f9 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:49:10 -0400 Subject: [PATCH] Actually fix emotion cache bullshittery this time --- app/createEmotionCache.ts | 7 ++++++- app/root.tsx | 4 ++-- server.ts | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/createEmotionCache.ts b/app/createEmotionCache.ts index 6005330..816493b 100644 --- a/app/createEmotionCache.ts +++ b/app/createEmotionCache.ts @@ -3,5 +3,10 @@ import createCache from "@emotion/cache"; export const defaultCache = createEmotionCache(); export default function createEmotionCache() { - return createCache.default({ key: "cha" }); + // @ts-expect-error + // The browser throws when calling .default, but the server throws if we don't call .default + // Of course! + return typeof document === "undefined" + ? createCache.default({ key: "cha" }) + : createCache({ key: "cha" }); } diff --git a/app/root.tsx b/app/root.tsx index 39b03fa..4e7edc8 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -158,8 +158,8 @@ function getMarkup( ) : null} - {helmet.meta?.toString()} - {helmet.title?.toString() ?? Car Crushers} + {helmet?.meta?.toString()} + {helmet?.title?.toString() ?? Car Crushers} {body} diff --git a/server.ts b/server.ts index 25124f0..b48a074 100644 --- a/server.ts +++ b/server.ts @@ -1,6 +1,6 @@ import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages"; -// @ts-ignore -import build from "@remix-run/dev/server-build."; +// @ts-expect-error +import * as build from "@remix-run/dev/server-build"; const handleRequest = createPagesFunctionHandler({ build,