Add nonce parameter to cache creator
This commit is contained in:
parent
7d8f9ac791
commit
969b304193
@ -2,11 +2,11 @@ import createCache from "@emotion/cache";
|
||||
|
||||
export const defaultCache = createEmotionCache();
|
||||
|
||||
export default function createEmotionCache() {
|
||||
export default function createEmotionCache(nonce?: string) {
|
||||
// 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.default({ key: "cha", nonce })
|
||||
: // @ts-expect-error
|
||||
createCache({ key: "cha" });
|
||||
createCache({ key: "cha", nonce });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user