Drop legacy React DOM Server in Edge runtime (#40018)
When possible (`ReactRoot` enabled), we always use `renderToReadableStream` to render the element to string and drop all `renderToString` and `renderToStaticMarkup` usages. Since this is always true for the Edge Runtime (which requires React 18+), so we can safely eliminate the `./cjs/react-dom-server-legacy.browser.production.min.js` module there ([ref](https://unpkg.com/browse/react-dom@18.2.0/server.browser.js)). This reduces the gzipped bundle by 11kb (~9%). Let me know if there's any concern or it's too hacky. <img width="904" alt="image" src="https://user-images.githubusercontent.com/11064311/192544933-298e3638-13ba-436d-9bcb-42dfb1224025.png"> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have 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 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.md#adding-examples) Co-authored-by:Jimmy Lai <laijimmy0@gmail.com>
Showing
Please
register
or
sign in
to comment