@@ -14,8 +14,15 @@ import { renderRsc, renderRscElement, getExtractFormState } from './rsc.js';
14
14
// TODO move types somewhere
15
15
import type { HandlerContext } from '../middleware/types.js' ;
16
16
17
- // HACK depending on these constants is not ideal
18
- import { DEFAULT_HTML_HEAD } from '../plugins/vite-plugin-rsc-index.js' ;
17
+ // This should be consistent with the one in vite-plugin-rsc-index.ts
18
+ const DEFAULT_HTML_HEAD = [
19
+ createElement ( 'meta' , { charSet : 'utf-8' } ) ,
20
+ createElement ( 'meta' , {
21
+ name : 'viewport' ,
22
+ content : 'width=device-width, initial-scale=1' ,
23
+ } ) ,
24
+ createElement ( 'meta' , { name : 'generator' , content : 'Waku' } ) ,
25
+ ] ;
19
26
20
27
type Elements = Record < string , ReactNode > ;
21
28
@@ -56,11 +63,7 @@ const injectHtmlHead = (
56
63
data . slice ( 0 , closingHeadIndex + CLOSING_HEAD . length ) ,
57
64
data . slice ( closingHeadIndex + CLOSING_HEAD . length ) ,
58
65
] ;
59
- head =
60
- head . slice ( 0 , - CLOSING_HEAD . length ) +
61
- DEFAULT_HTML_HEAD +
62
- htmlHead +
63
- CLOSING_HEAD ;
66
+ head = head . slice ( 0 , - CLOSING_HEAD . length ) + htmlHead + CLOSING_HEAD ;
64
67
const matchPrefetched = head . match (
65
68
// HACK This is very brittle
66
69
/ ( .* < s c r i p t [ ^ > ] * > \n g l o b a l T h i s \. _ _ W A K U _ P R E F E T C H E D _ _ = { \n ) ( .* ?) ( \n } ; .* ) / s,
@@ -226,6 +229,7 @@ export async function renderHtml(
226
229
Omit < ComponentProps < typeof ServerRoot > , 'children' >
227
230
> ,
228
231
{ elements : elementsPromise } ,
232
+ ...DEFAULT_HTML_HEAD ,
229
233
htmlNode as any ,
230
234
) ,
231
235
{
0 commit comments