Unverified Commit 24b60030 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Do not bundle `react-dom` in the SSR build (#41227)

Currently `react-dom` isn't handled as an external dependency in SSR,
unlike `react`. This means that the ReactDOM imported by client
components isn't the same instance as the ReactDOM that does SSR.

This PR also upgrades React experimental to the latest version.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent 5e6b008b
......@@ -183,8 +183,8 @@
"react-17": "npm:react@17.0.2",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-exp": "npm:react-dom@0.0.0-experimental-65b3449c8-20221005",
"react-exp": "npm:react@0.0.0-experimental-65b3449c8-20221005",
"react-dom-exp": "npm:react-dom@0.0.0-experimental-e40893d09-20221005",
"react-exp": "npm:react@0.0.0-experimental-e40893d09-20221005",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
......
......@@ -1049,7 +1049,7 @@ export default async function getBaseWebpackConfig(
// Absolute requires (require('/foo')) are extremely uncommon, but
// also have no need for customization as they're already resolved.
if (!isLocal) {
if (/^(?:next$|react(?:$|\/))/.test(request)) {
if (/^(?:next$|react(?:$|\/)|react-dom(?:$|\/))/.test(request)) {
return `commonjs ${request}`
}
......
......@@ -144,8 +144,8 @@ importers:
react-17: npm:react@17.0.2
react-dom: 18.2.0
react-dom-17: npm:react-dom@17.0.2
react-dom-exp: npm:react-dom@0.0.0-experimental-65b3449c8-20221005
react-exp: npm:react@0.0.0-experimental-65b3449c8-20221005
react-dom-exp: npm:react-dom@0.0.0-experimental-e40893d09-20221005
react-exp: npm:react@0.0.0-experimental-e40893d09-20221005
react-ssr-prepass: 1.0.8
react-virtualized: 9.22.3
relay-compiler: 13.0.2
......@@ -303,8 +303,8 @@ importers:
react-17: /react/17.0.2
react-dom: 18.2.0_react@18.2.0
react-dom-17: /react-dom/17.0.2_react@18.2.0
react-dom-exp: /react-dom/0.0.0-experimental-65b3449c8-20221005_react@18.2.0
react-exp: /react/0.0.0-experimental-65b3449c8-20221005
react-dom-exp: /react-dom/0.0.0-experimental-e40893d09-20221005_react@18.2.0
react-exp: /react/0.0.0-experimental-e40893d09-20221005
react-ssr-prepass: 1.0.8_qncsgtzehe3fgiqp6tr7lwq6fm
react-virtualized: 9.22.3_biqbaboplfbrettd7655fr4n2y
relay-compiler: 13.0.2
......@@ -25221,17 +25221,17 @@ packages:
strip-json-comments: 2.0.1
dev: true
/react-dom/0.0.0-experimental-65b3449c8-20221005_react@18.2.0:
/react-dom/0.0.0-experimental-e40893d09-20221005_react@18.2.0:
resolution:
{
integrity: sha512-EwMQkdTwP8NNAgtZS6Z+Pia3BJ5WetngkNtqZKtah8sGw5wx+1FjvEKzYuFCxwAzJIIoyCyoDbvHZYmi/XSgJw==,
integrity: sha512-Zw1FWTy9XEiiLU1KCYFpLUs1KAMiNfWW1Clz0DCX1diGLeSfBhp2Jd3/7+v8U9SWs3jFFZJ2ttTOgTs+T2aheA==,
}
peerDependencies:
react: 0.0.0-experimental-65b3449c8-20221005
react: 0.0.0-experimental-e40893d09-20221005
dependencies:
loose-envify: 1.4.0
react: 18.2.0
scheduler: 0.0.0-experimental-65b3449c8-20221005
scheduler: 0.0.0-experimental-e40893d09-20221005
dev: true
/react-dom/17.0.2_react@18.2.0:
......@@ -25345,10 +25345,10 @@ packages:
react-lifecycles-compat: 3.0.4
dev: true
/react/0.0.0-experimental-65b3449c8-20221005:
/react/0.0.0-experimental-e40893d09-20221005:
resolution:
{
integrity: sha512-JzDw7MRIZPNWiwk/d5tAlB9Ol0LveXNV03Iz8Q5OQ3+zaNTDQYg1s3uCPUKaG2qi3z9JrkV3wjmN2gbc7G9KfQ==,
integrity: sha512-Ecty2+zCaj6yG/4QC5cdhwRQ2kF3FuMMniyUxvmfvtlz9oOMus3tQpnEeITD01rN/nkDO8CXqQfdChSk/qVL6w==,
}
engines: { node: '>=0.10.0' }
dependencies:
......@@ -26721,10 +26721,10 @@ packages:
xmlchars: 2.2.0
dev: true
/scheduler/0.0.0-experimental-65b3449c8-20221005:
/scheduler/0.0.0-experimental-e40893d09-20221005:
resolution:
{
integrity: sha512-SPjqfOVw94GbPZah2aI74S78QR4LQ8CQ4JPIaVVwbdkQRtVjxEb5pWxFtCN0lyAZdA8T2Hox3fhxpbaIxbohVg==,
integrity: sha512-rvE4D7bJ9P97/Ukc8zh3fTbRi5kGB4xBus3fuWhs1afwSJH7P5LIo6mtL9eO7o69KdxyYfcjjIB2i+P8yrSOGA==,
}
dependencies:
loose-envify: 1.4.0
......@@ -30816,7 +30816,10 @@ packages:
dev: true
/yauzl/2.10.0:
resolution: { integrity: sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk= }
resolution:
{
integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==,
}
dependencies:
buffer-crc32: 0.2.13
fd-slicer: 1.1.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment