Skip to content

Commit

Permalink
Remove redundant react-dom/server.browser shim
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Aug 20, 2024
1 parent 15aeb92 commit 299b365
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 83 deletions.
3 changes: 1 addition & 2 deletions packages/next/src/build/create-compiler-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,8 @@ export function createRSCAliases(
'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`,
// optimizations to ignore the legacy build of react-dom/server in `server.browser` build
// optimizations to ignore the legacy build of react-dom/server in `server.edge` build
'react-dom/server.edge$': `next/dist/build/webpack/alias/react-dom-server-edge${bundledReactChannel}.js`,
'react-dom/server.browser$': `next/dist/build/webpack/alias/react-dom-server-browser${bundledReactChannel}.js`,
// react-server-dom-webpack alias
...createRSCRendererAliases(bundledReactChannel),
}
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions packages/next/src/build/webpack/alias/react-dom-server-browser.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/next/types/$$compiled.internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ declare module 'next/dist/compiled/react-server-dom-turbopack/server.edge'
declare module 'next/dist/client/app-call-server'
declare module 'next/dist/compiled/react-dom/server'
declare module 'next/dist/compiled/react-dom/server.edge'
declare module 'next/dist/compiled/react-dom/server.browser'
declare module 'next/dist/compiled/browserslist'

declare module 'react-server-dom-webpack/client'
Expand Down
2 changes: 0 additions & 2 deletions packages/next/types/react-dom.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
declare module 'react-dom/server.browser'

declare module 'react-dom/server.edge' {
import type { JSX } from 'react'
/**
Expand Down
3 changes: 0 additions & 3 deletions packages/next/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const pagesExternals = [
'react-dom/package.json',
'react-dom/client',
'react-dom/server',
'react-dom/server.browser',
'react-dom/server.edge',
'react-server-dom-webpack/client',
'react-server-dom-webpack/client.edge',
Expand Down Expand Up @@ -45,8 +44,6 @@ function makeAppAliases(reactChannel = '') {
'react-dom/static.browser$': `next/dist/compiled/react-dom${reactChannel}/static.browser`,
// optimizations to ignore the legacy build of react-dom/server in `server.browser` build
'react-dom/server.edge$': `next/dist/build/webpack/alias/react-dom-server-edge${reactChannel}.js`,
// In Next.js runtime only use react-dom/server.edge
'react-dom/server.browser$': 'react-dom/server.edge',
// react-server-dom-webpack alias
'react-server-dom-turbopack/client$': `next/dist/compiled/react-server-dom-turbopack${reactChannel}/client`,
'react-server-dom-turbopack/client.edge$': `next/dist/compiled/react-server-dom-turbopack${reactChannel}/client.edge`,
Expand Down
46 changes: 3 additions & 43 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,47 +83,7 @@ describe('react-dom/server in React Server environment', () => {
`)
}
} else {
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"
]
}"
`)
}
await assertHasRedbox(browser)
}
const redbox = {
description: await getRedboxDescription(browser),
Expand All @@ -139,7 +99,7 @@ describe('react-dom/server in React Server environment', () => {
} else {
expect(redbox).toMatchInlineSnapshot(`
{
"description": null,
"description": "Error: react-dom/server is not supported in React Server Components.",
"source": null,
}
`)
Expand Down

0 comments on commit 299b365

Please sign in to comment.