Skip to content

Commit

Permalink
fix: normalize RSC chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
frandiox committed Jan 12, 2022
1 parent 6f1e8e7 commit c56d374
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/hydrogen/src/entry-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ function flightContainer({
chunk?: string;
nonce?: string;
}) {
const normalizedChunk = chunk?.replace(/\\/g, String.raw`\\`);

return `<script${nonce ? ` nonce="${nonce}"` : ''}>window.__flight${
init ? '=[]' : `.push(\`${chunk}\`)`
init ? '=[]' : `.push(\`${normalizedChunk}\`)`
}</script>`;
}

Expand Down

0 comments on commit c56d374

Please sign in to comment.