Skip to content

[Bug]: circular dependency detection is non-deterministic #9889

@ska-kialo

Description

@ska-kialo

System Info

System:
  OS: macOS 14.7.2
  CPU: (10) arm64 Apple M1 Max
  Memory: 2.93 GB / 32.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
  Yarn: 4.7.0 - ~/.nvm/versions/node/v22.14.0/bin/yarn
  npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
Browsers:
  Chrome: 133.0.6943.143
  Edge: 113.0.1774.35
  Safari: 18.2
npmPackages:
  @rspack/cli: 1.3.1 => 1.3.1
  @rspack/core: 1.3.1 => 1.3.1
  @rspack/plugin-react-refresh: 1.1.0 => 1.1.0

Details

While trying to switch to the CircularDependencyRspackPlugin I noticed an inconsistency between running on my local machine and our CI.

We detect dependency cycles and allow defining allowed ones, these are then checked against the plugin's output in the CI. We have the following structure with 3 cycles:

  • A.tsx -> B.tsx -> C.tsx -> D.tsx -> G.tsx -> H.tsx -> A.tsx
  • A.tsx -> B.tsx -> C.tsx -> E.tsx -> G.tsx -> H.tsx -> A.tsx
  • A.tsx -> B.tsx -> C.tsx -> F.tsx -> G.tsx -> H.tsx -> A.tsx

With the adapted webpack plugin (https://github.com/kialo/rspack-circular-dependency-plugin) all three cycles were detected. The rspack internal plugin now only detects one of these. Which one is detected seems to depend on the machine. Locally I get the cycle including module D.tsx while our CI detects the cycle with module E.tsx which makes it fail.

I unfortunately haven't been able to reproduce this using the example repository yet.

Reproduce link

No response

Reproduce Steps

See above.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions