Skip to content
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

Build renderers into their individual npm packages #7168

Merged
merged 1 commit into from
Aug 11, 2016

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Jul 2, 2016

Builds on top of #7164 with one commit 7c6a95c

This copies modules into three separate packages instead of putting it all in React.

The overlap in shared folders gets duplicated.

This allows the isomorphic package to stay minimal. It can also be used as a direct dependency without much risk.

This also allow us to ship versions to each renderer independently and we can ship renderers without updating the main react package dependency.

@sebmarkbage
Copy link
Collaborator Author

The next step would be to flat bundle these.

One benefit of this is that we don't actually have to use react-native-renderer in React Native nor react-dom in FB (www). We can just copy in those source files instead of the bundle if we want.

As long as we use the react npm package as the source of truth, then third party components (minus the ones using findDOMNode), in the npm world, will just work in those environments since that's what they depend on.

I'm still a bit skeptical of the copying strategy because it delays use of smart build systems (optimizing compilers like closure compiler, emscripten for hot paths, Reason, etc) if we're limited to also getting those systems integrated into the downstreams.

@sebmarkbage
Copy link
Collaborator Author

We might want to build the fiber renderer as its own standalone npm package that anyone can use to build a renderer. That would be great for React ART, and therefore anyone building a renderer in an external repo.

We only really need the duplication for the existing stateful DI.

@gaearon
Copy link
Collaborator

gaearon commented Jul 5, 2016

We might want to build the fiber renderer as its own standalone npm package that anyone can use to build a renderer.

👍 I think this would be amazing for learning and experimentation!

@sebmarkbage sebmarkbage force-pushed the separatenpmbuilds branch 4 times, most recently from 770b799 to cccb686 Compare August 9, 2016 21:13
sebmarkbage added a commit to sebmarkbage/react that referenced this pull request Aug 9, 2016
Without this we end up bundling all of the isomorphic React into
the DOM bundle. This was fixed in facebook#7168 too but I'll just do an
early fix to ensure that facebook#7168 is purely an npm change.
sebmarkbage added a commit that referenced this pull request Aug 9, 2016
Without this we end up bundling all of the isomorphic React into
the DOM bundle. This was fixed in #7168 too but I'll just do an
early fix to ensure that #7168 is purely an npm change.
'./ReactCurrentOwner': SECRET_INTERNALS_NAME + '.ReactCurrentOwner',
'./ReactComponentTreeHook': SECRET_INTERNALS_NAME + '.ReactComponentTreeHook',
// All these methods are shared are exposed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm

@zpao
Copy link
Member

zpao commented Aug 10, 2016

Alright, let's do it. Let's just fix the addons packaging bit and it's good to go.

@@ -141,7 +139,6 @@ var ReactTestRenderer = {

/* eslint-disable camelcase */
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be in the test renderer according to @spicyj because this currently uses the ReactDOM dependency.

This copies modules into three separate packages instead of
putting it all in React.

The overlap in shared and between renderers gets duplicated.

This allows the isomorphic package to stay minimal. It can also
be used as a direct dependency without much risk.

This also allow us to ship versions to each renderer independently
and we can ship renderers without updating the main react package
dependency.
@sebmarkbage sebmarkbage merged commit 0f004ef into facebook:master Aug 11, 2016
@zpao zpao modified the milestone: 15-next Sep 8, 2016
@zpao zpao modified the milestones: 15-next, 15.4.0 Oct 4, 2016
zpao pushed a commit that referenced this pull request Oct 4, 2016
Without this we end up bundling all of the isomorphic React into
the DOM bundle. This was fixed in #7168 too but I'll just do an
early fix to ensure that #7168 is purely an npm change.
(cherry picked from commit ca9167c)
zpao pushed a commit that referenced this pull request Oct 4, 2016
This copies modules into three separate packages instead of
putting it all in React.

The overlap in shared and between renderers gets duplicated.

This allows the isomorphic package to stay minimal. It can also
be used as a direct dependency without much risk.

This also allow us to ship versions to each renderer independently
and we can ship renderers without updating the main react package
dependency.
(cherry picked from commit 0f004ef)
@xgqfrms-GitHub
Copy link

old require (CommonJS)

react commonjs require

new import (ES6)

react es6 import

NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
This copies modules into three separate packages instead of
putting it all in React.

The overlap in shared and between renderers gets duplicated.

This allows the isomorphic package to stay minimal. It can also
be used as a direct dependency without much risk.

This also allow us to ship versions to each renderer independently
and we can ship renderers without updating the main react package
dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants