* `react-dom/server` in the browser bundles both the streaming and the legacy * renderer, but Decap (shortcode previews) and Plate only call * `renderToString`/`renderToStaticMarkup`, which live in the legacy one. * Point the import straight at that file to drop the unused renderer.
()
| 103 | * Point the import straight at that file to drop the unused renderer. |
| 104 | */ |
| 105 | function reactDomServerAlias() { |
| 106 | let reactDomDir; |
| 107 | try { |
| 108 | reactDomDir = path.dirname( |
| 109 | require.resolve('react-dom/package.json', { paths: [process.cwd()] }), |
| 110 | ); |
| 111 | } catch { |
| 112 | return {}; |
| 113 | } |
| 114 | const build = isProduction ? 'production' : 'development'; |
| 115 | return { |
| 116 | 'react-dom/server$': path.join(reactDomDir, `cjs/react-dom-server-legacy.browser.${build}.js`), |
| 117 | }; |
| 118 | } |
| 119 | |
| 120 | const umdPath = path.resolve(process.cwd(), 'dist'); |
| 121 | const umdDirPath = path.resolve(process.cwd(), 'dist/umd'); |