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

Detect and handle webpack module cycles #4874

Merged
merged 2 commits into from Apr 2, 2020

Conversation

vojtechszocs
Copy link
Contributor

@vojtechszocs vojtechszocs commented Apr 1, 2020

This PR attempts to get a handle on the situation around circular module dependencies.

When running yarn check-cycles, module cycles are detected via CircularDependencyPlugin and subsequently handled at emit phase via ad-hoc HandleCyclesPlugin.

Cycle report is written to frontend/.webpack-cycles file.

cycles

Example cycle report:

# webpack compilation e656e6844f982012ba0f built at 04/01/2020 15:39:26
# this file is auto-generated on every webpack development build

# 168 total cycles: public (97), packages (71)
# 31 minimal-length cycles (A -> B -> A)

/home/vszocs/go/src/github.com/openshift/console/frontend/public/redux.ts
public/redux.ts
-> public/reducers/features.ts
-> public/module/k8s/index.ts
-> public/module/k8s/resource.js
-> public/co-fetch.js
-> public/redux.ts

... rest of cycle entries ...

Cycle report analysis:

  • we have a very high number of cycles (and it keeps increasing over time)
  • we have a relatively high number of A -> B -> A cycles

cc @spadgett @christianvogt

@@ -165,7 +165,7 @@
"cache-loader": "1.x",
"chalk": "2.3.x",
"chromedriver": "77.x",
"circular-dependency-plugin": "5.0.2",
"circular-dependency-plugin": "5.x",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note, this dependency was introduced in #1456 (unused until now).

@christianvogt
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2020
@spadgett
Copy link
Member

spadgett commented Apr 2, 2020

/approve
/retest

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, spadgett, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2020
@openshift-merge-robot openshift-merge-robot merged commit 4c375cc into openshift:master Apr 2, 2020
@spadgett spadgett added this to the v4.5 milestone Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants