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

Removed all cyclic dependencies. #55

Closed
wants to merge 1 commit into from

Conversation

originalgremlin
Copy link

Hi. In my attempts to include this code in a React Native project I discovered a number of cyclic dependencies that prevented their default packager from completing. With the liberal rewriting of a few requires all the cycles have been eliminated (according to pahen/madge).

These changes are all superficial. All tests continue to pass.

@dcousens
Copy link

Probably don't rebuild the dist/ files yourself @originalgremlin, it'll be done by the package maintainer.

Otherwise LGTM 👍

@indutny
Copy link
Owner

indutny commented Sep 29, 2015

Hm... Doesn't LGTM. I use cyclic dependencies in all my project, as the way to deliver features to different parts of its internals. What about posting an issue at React Native instead? Fixing recursive requires is very simple.

@dcousens
Copy link

@indutny on the plus side, you get a require error if the module doesn't exist using this method compared to the .utils access.
The bundler might also be able to drop some modules if they aren't being used (as a pattern, not necessarily in this case).

@indutny
Copy link
Owner

indutny commented Sep 29, 2015

@dcousens all modules are used :) And we have tests for obvious errors.

@dcousens
Copy link

@indutny true, but, assuming there are no other reasons not too, there is no downside to merging this PR?

@indutny
Copy link
Owner

indutny commented Sep 29, 2015

@dcousens the downside is that it sort of code style for me:

It is a matter of principle for me :) Especially, considering that the root of the issue is not in this project anyway.

@indutny
Copy link
Owner

indutny commented Sep 29, 2015

@originalgremlin nevertheless, I appreciate your contribution! It just does seem to me that we are trying to fix the problem at the wrong place.

@dcousens
Copy link

@indutny fair enough 👻
@originalgremlin please reference the issue for react-native if you create one.

@originalgremlin
Copy link
Author

@indutny Yes, I agree that the react-native packager is far from complete and should deal with cyclic dependencies with more grace than a full lockup.

I don't really expect you to change all your codebases, considering that this is your preferred style. To get my current code working the easiest and most direct way was to modify these few libraries rather than dig into the bowels of the packager. I personally find cyclic dependencies to be a bit confusing to work with and prone to error. They're certainly not in fashion in the wider community. But for now I'll point my dependencies to my forks and start pestering the react-native folks. Cheers.

@dcousens
Copy link

I personally find cyclic dependencies to be a bit confusing to work with and prone to error

Agreed, I personally don't find it easy to reason about their exact semantics, especially not at face value since it depends a lot on how Javascript works internally.

@indutny
Copy link
Owner

indutny commented Mar 31, 2016

Closing, sorry!

@indutny indutny closed this Mar 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants