diff --git a/packages/react-dom/server.browser.js b/packages/react-dom/server.browser.js index ed3636d4c0ee0..fb8e4f06b3d4d 100644 --- a/packages/react-dom/server.browser.js +++ b/packages/react-dom/server.browser.js @@ -9,4 +9,10 @@ 'use strict'; -module.exports = require('./src/server/ReactDOMServerBrowser'); +var ReactDOMServer = require('./src/server/ReactDOMServerBrowser'); + +// TODO: decide on the top-level export form. +// This is hacky but makes it work with both Rollup and Jest +module.exports = ReactDOMServer.default + ? ReactDOMServer.default + : ReactDOMServer; diff --git a/packages/react-dom/server.node.js b/packages/react-dom/server.node.js index 27cd64e7ce9ec..35e73a0d1918e 100644 --- a/packages/react-dom/server.node.js +++ b/packages/react-dom/server.node.js @@ -9,4 +9,10 @@ 'use strict'; -module.exports = require('./src/server/ReactDOMServerNode'); +var ReactDOMServer = require('./src/server/ReactDOMServerNode'); + +// TODO: decide on the top-level export form. +// This is hacky but makes it work with both Rollup and Jest +module.exports = ReactDOMServer.default + ? ReactDOMServer.default + : ReactDOMServer; diff --git a/packages/react-dom/src/server/ReactDOMServerBrowser.js b/packages/react-dom/src/server/ReactDOMServerBrowser.js index cd6f3a61d4c22..f4dd6dfa64233 100644 --- a/packages/react-dom/src/server/ReactDOMServerBrowser.js +++ b/packages/react-dom/src/server/ReactDOMServerBrowser.js @@ -27,11 +27,11 @@ function renderToStaticNodeStream() { ); } -export { +// Note: when changing this, also consider /~https://github.com/facebook/react/issues/11526 +export default { renderToString, renderToStaticMarkup, renderToNodeStream, renderToStaticNodeStream, + version: ReactVersion, }; - -export const version = ReactVersion; diff --git a/packages/react-dom/src/server/ReactDOMServerNode.js b/packages/react-dom/src/server/ReactDOMServerNode.js index 41ad9422af109..015ba082fdcb9 100644 --- a/packages/react-dom/src/server/ReactDOMServerNode.js +++ b/packages/react-dom/src/server/ReactDOMServerNode.js @@ -14,11 +14,11 @@ import { renderToStaticNodeStream, } from './ReactDOMNodeStreamRenderer'; -export { +// Note: when changing this, also consider /~https://github.com/facebook/react/issues/11526 +export default { renderToString, renderToStaticMarkup, renderToNodeStream, renderToStaticNodeStream, + version: ReactVersion, }; - -export const version = ReactVersion;