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

Move ReactFiberTreeReflection to react-reconciler/reflection #11659

Closed
gaearon opened this issue Nov 25, 2017 · 12 comments
Closed

Move ReactFiberTreeReflection to react-reconciler/reflection #11659

gaearon opened this issue Nov 25, 2017 · 12 comments

Comments

@gaearon
Copy link
Collaborator

gaearon commented Nov 25, 2017

We should:

  • Move ReactFiberTreeReflection to be exported from react-reconciler/reflection entry point (similar to how react-dom/test-utils entry point is set up).
  • Create a flat bundle for it (similar to how react-dom/test-utils is set up in bundles.js).
  • Change code that imports ReactFiberTreeReflection directly to do it through react-reconciler/reflection instead.
  • Make react-reconciler a dependency of react-noop-renderer in package.json. This should ensure the reconciler doesn't actually get bundled with react-noop-renderer, and instead stays a require() call. Then the interaction of these two packages will actually be tested when you run yarn test-build (after yarn build core,noop,reconciler --type=NODE).

This task is not friendly to beginners. It requires an understanding of the relationship between different packages, and a willingness to research and experiment with how our build process is set up.

@adamsau
Copy link
Contributor

adamsau commented Nov 25, 2017

can i work on this one? I may need some time to study it first~

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 25, 2017

Sure, but please don't disappear and keep us updated. :-)

@adamsau
Copy link
Contributor

adamsau commented Nov 25, 2017

no problem! will keep you posted!

@hardikmodha
Copy link

Add me in a queue. :)

@adamsau
Copy link
Contributor

adamsau commented Nov 27, 2017

@gaearon I think i am on the right track. Currently, the build process is using rollup to bundle the imports into a single js file. Instead of bundling together, we want it to be a dependency and load it using require after the bundling process.

I notice that ReactFiberTreeReflection is also used in packages like react-dom, react-native-renderer, etc, does that mean i need to add the dependency in their package.json as well? I may also need to experiment with the "external" options in bundle.js to see if it can correctly bundle using require statements.

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 27, 2017

Instead of bundling together, we want it to be a dependency and load it using require after the bundling process.

Yes, but only for react-noop-renderer.

I may also need to experiment with the "external" options in bundle.js to see if it can correctly bundle using require statements.

I think our build process should automatically treat something as an external for CommonJS builds if it's in dependencies. I think just adding "react-reconciler": "*" to react-noop-renderer might be enough. It's fine to use wildcard because this is a private package.

@adamsau
Copy link
Contributor

adamsau commented Nov 27, 2017

image

@gaearon, the "ReactFiberInstrumentation" cannot be found when trying to run yarn test-build after making react-conciler as a dependency because it does not exists as a flat bundle when loading "ReactNoop". Should i also convert this into another flat bundle? Or export it in "ReactFiberReconciler"?

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 27, 2017

I forgot about that one. Let's just remove that import for now? It's only used by a debugging tool that I haven't updated for months anyway. We'll figure out how to fix it later.

@adamsau
Copy link
Contributor

adamsau commented Nov 28, 2017

@gaearon same as ReactFiber, ReactFiberUpdateQueue in ReactNoop. Should i make a flat bundle for them to fix those direct imports?

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 28, 2017

These are type imports, not real imports. They won't affect the tests or the build.

@adamsau
Copy link
Contributor

adamsau commented Nov 28, 2017

gotcha, those are for flows.

gaearon pushed a commit that referenced this issue Nov 28, 2017
* Move ReactFiberTreeReflection to react-reconciler/reflection #11659

* Use * for react-reconciler

We don't know the latest local version, and release script currently doesn't bump deps automatically.

* Remove unused field

* Use CommonJS in entry point for consistency

* Undo the CommonJS change

I didn't realize it would break the build.

* Record sizes

* Remove reconciler fixtures

They're unnecessary now that we run real tests on reconciler bundles.
@gaearon
Copy link
Collaborator Author

gaearon commented Nov 28, 2017

Fixed in #11683.
Thanks @rivenhk!

@gaearon gaearon closed this as completed Nov 28, 2017
NMinhNguyen referenced this issue in enzymejs/react-shallow-renderer Jan 29, 2020
* Move ReactFiberTreeReflection to react-reconciler/reflection #11659

* Use * for react-reconciler

We don't know the latest local version, and release script currently doesn't bump deps automatically.

* Remove unused field

* Use CommonJS in entry point for consistency

* Undo the CommonJS change

I didn't realize it would break the build.

* Record sizes

* Remove reconciler fixtures

They're unnecessary now that we run real tests on reconciler bundles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants