Skip to content

Commit 1223d74

Browse files
codebender828pi0
authored andcommitted
fix: ssr ids should be the same
1 parent 635b5d5 commit 1223d74

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/runtime/emotion.server.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { extractCritical } from '@emotion/server'
2-
import { NitroApp } from 'nitropack'
1+
import { extractCritical } from "@emotion/server";
2+
import { NitroApp } from "nitropack";
33

44
/**
55
* Why are we declaring types for `defineNitroPlugin`?
@@ -20,18 +20,18 @@ export interface NitroAppPlugin {
2020
(nitro: NitroApp): void;
2121
}
2222

23-
export function defineNitroPlugin (def: NitroAppPlugin): NitroAppPlugin {
24-
return def
23+
export function defineNitroPlugin(def: NitroAppPlugin): NitroAppPlugin {
24+
return def;
2525
}
2626

2727
export default defineNitroPlugin((nitroApp) => {
28-
nitroApp.hooks.hook('render:html', (html) => {
29-
const { ids, css } = extractCritical(html.body)
30-
html.head.push(`<style data-emotion="${ids.join(' ')}">${css}</style>`)
28+
nitroApp.hooks.hook("render:html", (html) => {
29+
const { ids, css } = extractCritical(html.body);
30+
html.head.push(`<style data-emotion="${ids.join(" ")}">${css}</style>`);
3131
html.head.push(
3232
`<script data-emotion="${ids.join(
33-
' '
34-
)}">window.$emotionIds=${JSON.stringify(ids)}</script>`
35-
)
36-
})
37-
})
33+
" "
34+
)}">window.$emotionSSRIds=${JSON.stringify(ids)}</script>`
35+
);
36+
});
37+
});

0 commit comments

Comments
 (0)