-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Detect circular dependencies in the codebase #35303
Comments
Pinging @elastic/kibana-platform |
I'm interested, as long as it doesn't get in the way of us doing things we need to! |
We just ran into a bad circular deps issue on our end and what we did without full tooling in the meantime to detect and fix them was: Install madge globally npm -g install madge Run a build yarn build --no-oss --skip-os-packages Then after the build go to the transpiled code: cd ~/projects/kibana/build/kibana/x-pack/plugins And run madge against a plugin or project madge -c ${plugin_name} That gave us a list in which we fixed. |
looks like |
We have been using a script which calls in |
closed in favour of #78162 |
Problem
We faced a problem with the new
babel preset typescript
setup.Modules with circular dependencies are processed by webpack without warnings, but sometimes in runtime exports aren't defined.
@mistic :
The problem confuses developers and it is very hard to debug. Every project where I worked before had problems with circular deps and it led to long hours of debugging.
Suggestion
Since we are in a process of migration to the new platform, it looks like a good time to introduce additional checks to avoid future problems with cyclic deps.
I'd suggest adding an analyzer in our pipeline, preferably it's runnable with CLI interface. https://github.com/pahen/madge works well on my other projects so far.
If you want to test the output, run:
Ofc, it doesn't support our custom module resolution mechanism.
Want to hear from @elastic/kibana-operations
The text was updated successfully, but these errors were encountered: