Use single entry point for SSR via browser field#10362
Use single entry point for SSR via browser field#10362gaearon merged 7 commits intofacebook:masterfrom
Conversation
| * @providesModule ReactDOMServerEntry | ||
| * @providesModule ReactDOMServerBrowserEntry | ||
| */ | ||
|
|
There was a problem hiding this comment.
We could add shims that throw for renderToStream() APIs here. Then it's less mysterious.
There was a problem hiding this comment.
Yes that would be nice.
| "cjs/", | ||
| "umd/" | ||
| ], | ||
| "browser": { |
There was a problem hiding this comment.
It might be nicer to do this with a more public browser entry point instead of the internal package details (personally I'd prefer not exposing those as separate files at all and just inline them).
With a public entry point it's at least possible to manually require the browser version if you need to. This encourages require to the internal implementation details instead.
sebmarkbage
left a comment
There was a problem hiding this comment.
It might be nice to keep a public react-dom/server.browser.js that switches between dev/prod of the browser build. That way it's possible to work around the default by requiring this directly instead of deep linking. I'll let you decide tho.
I wanted to do that but couldn’t decide on the naming. I like yours. |
|
Just tested in Node, webpack, and browserify, and it works as expected. |
|
Oops, sorry 😛 |
Haven’t verified this works yet, will test tomorrow.
But that’s the basic idea.