MCPcopy Create free account
hub / github.com/decaporg/decap-cms / reactDomServerAlias

Function reactDomServerAlias

scripts/webpack.js:105–118  ·  view source on GitHub ↗

* `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.

()

Source from the content-addressed store, hash-verified

103 * Point the import straight at that file to drop the unused renderer.
104 */
105function 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
120const umdPath = path.resolve(process.cwd(), 'dist');
121const umdDirPath = path.resolve(process.cwd(), 'dist/umd');

Callers 1

baseConfigFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected