-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use single entry point for SSR via browser field #10362
Conversation
@@ -6,7 +6,7 @@ | |||
* LICENSE file in the root directory of this source tree. An additional grant | |||
* of patent rights can be found in the PATENTS file in the same directory. | |||
* | |||
* @providesModule ReactDOMServerEntry | |||
* @providesModule ReactDOMServerBrowserEntry | |||
*/ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add shims that throw for renderToStream()
APIs here. Then it's less mysterious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would be nice.
"test-utils.js", | ||
"unstable-native-dependencies.js", | ||
"cjs/", | ||
"umd/" | ||
], | ||
"browser": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
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.