Skip to content

Commit

Permalink
Ensure vendored react-dom/server.browser is used
Browse files Browse the repository at this point in the history
Silly oversight that we still need that alias.
I need to find out how the existing aliasing from `/server` to `/server.browser` works in browser builds.
Also confusing that CI originally didn't catch that mistake.
  • Loading branch information
eps1lon committed Aug 21, 2024
1 parent 0ac10d7 commit 18edce0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/next/src/build/create-compiler-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export function createRSCAliases(
'react/compiler-runtime$': `next/dist/compiled/react${bundledReactChannel}/compiler-runtime`,
'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`,
'react-dom/server$': `next/dist/compiled/react-dom${bundledReactChannel}/server`,
'react-dom/server.browser$': `next/dist/compiled/react-dom${bundledReactChannel}/server.browser`,
'react-dom/static$': `next/dist/compiled/react-dom${bundledReactChannel}/static`,
'react-dom/static.edge$': `next/dist/compiled/react-dom${bundledReactChannel}/static.edge`,
'react-dom/static.browser$': `next/dist/compiled/react-dom${bundledReactChannel}/static.browser`,
Expand Down
46 changes: 43 additions & 3 deletions test/development/app-dir/ssr-in-rsc/ssr-in-rsc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('react-dom/server in React Server environment', () => {
'/exports/app-code/react-dom-server-browser-explicit'
)

await assertNoRedbox(browser)
if (isTurbopack) {
await assertNoRedbox(browser)
if (isReactExperimental) {
expect(await browser.elementByCss('main').text())
.toMatchInlineSnapshot(`
Expand Down Expand Up @@ -83,7 +83,47 @@ describe('react-dom/server in React Server environment', () => {
`)
}
} else {
await assertHasRedbox(browser)
if (isReactExperimental) {
expect(await browser.elementByCss('main').text())
.toMatchInlineSnapshot(`
"{
"default": [
"renderToReadableStream",
"renderToStaticMarkup",
"renderToString",
"resume",
"version"
],
"named": [
"default",
"renderToReadableStream",
"renderToStaticMarkup",
"renderToString",
"resume",
"version"
]
}"
`)
} else {
expect(await browser.elementByCss('main').text())
.toMatchInlineSnapshot(`
"{
"default": [
"renderToReadableStream",
"renderToStaticMarkup",
"renderToString",
"version"
],
"named": [
"default",
"renderToReadableStream",
"renderToStaticMarkup",
"renderToString",
"version"
]
}"
`)
}
}
const redbox = {
description: await getRedboxDescription(browser),
Expand All @@ -99,7 +139,7 @@ describe('react-dom/server in React Server environment', () => {
} else {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Error: react-dom/server is not supported in React Server Components.",
"description": null,
"source": null,
}
`)
Expand Down

0 comments on commit 18edce0

Please sign in to comment.