Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(#41164): polyfill-module should block hydration #41352

Merged
merged 2 commits into from Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 2 additions & 9 deletions packages/next/server/app-render.tsx
Expand Up @@ -1479,17 +1479,10 @@ export async function renderToHTMLOrFlight(
return (
<script
key={polyfill.src}
src={polyfill.src}
integrity={polyfill.integrity}
noModule={true}
nonce={nonce}
dangerouslySetInnerHTML={{
__html: `(self.__next_s=self.__next_s||[]).push([${JSON.stringify(
polyfill.src
)},${
polyfill.integrity
? JSON.stringify({ integrity: polyfill.integrity })
: '{}'
}])`,
}}
/>
)
})}
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/app-dir/index.test.ts
Expand Up @@ -121,7 +121,9 @@ describe('app dir', () => {

it('should serve polyfills for browsers that do not support modules', async () => {
const html = await renderViaHTTP(next.url, '/dashboard/index')
expect(html).toMatch(/\/_next\/static\/chunks\/polyfills(-.+)?\.js/)
expect(html).toMatch(
/<script src="\/_next\/static\/chunks\/polyfills(-\w+)?\.js" nomodule="">/
)
})

// TODO-APP: handle css modules fouc in dev
Expand Down