Skip to content

Commit

Permalink
Optimize server bundle size (#57305)
Browse files Browse the repository at this point in the history
These are not used by the Next.js server and can save up to 15% size of the base Edge worker by ignoring them.
  • Loading branch information
shuding authored Oct 24, 2023
1 parent 69388a5 commit 4eaefba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next/src/build/create-compiler-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ export function createRSCAliases(
'react-server-dom-webpack/client.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/client.edge`,
'react-server-dom-webpack/server.edge$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/server.edge`,
'react-server-dom-webpack/server.node$': `next/dist/compiled/react-server-dom-webpack${bundledReactChannel}/server.node`,
// optimisations to ignore the legacy build of react-dom/server
'./cjs/react-dom-server-legacy.browser.production.min.js': `next/dist/build/noop-react-dom-server-legacy`,
'./cjs/react-dom-server-legacy.browser.development.js': `next/dist/build/noop-react-dom-server-legacy`,
}

if (!isEdgeServer) {
Expand Down

0 comments on commit 4eaefba

Please sign in to comment.