Skip to content

Commit

Permalink
move hydration script to head, make main module async
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Dec 21, 2023
1 parent 820f570 commit 51a1db2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions packages/start/server/StartServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ export function StartServer(props: { document: Component<DocumentComponentProps>
<NoHydration>
{docType as unknown as any}
<props.document
assets={<>{context.assets.map(m => renderAsset(m))}</>}
scripts={
assets={
<>
<HydrationScript />
{context.assets.map(m => renderAsset(m))}
</>
}
scripts={
<>
<script innerHTML={`window.manifest = ${JSON.stringify(context.manifest)}`} />
<script
type="module"
async
src={
import.meta.env.MANIFEST["client"].inputs[
import.meta.env.MANIFEST["client"].handler
Expand Down
8 changes: 6 additions & 2 deletions packages/start/server/spa/StartServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ export function StartServer(props) {
<NoHydration>
{docType as unknown as any}
<props.document
assets={<>{context.assets.map(m => renderAsset(m))}</>}
assets={
<>
<script>$R = [];</script>
{context.assets.map(m => renderAsset(m))}
</>
}
scripts={
<>
<script innerHTML={`window.manifest = ${JSON.stringify(context.manifest)}`} />
<script>$R = [];</script>
<script
type="module"
src={
Expand Down

0 comments on commit 51a1db2

Please sign in to comment.