rollup/commonjs plugin sometimes fails to detect circular dependency #1425
Closed
Description
- Rollup Plugin Name: rollup/plugin-commonjs
- Rollup Plugin Version: 24.0.0
- Rollup Version: 3.12.0
- Operating System (or Browser): MacOS 13.2 (or Chrome 109.0.5414.119 (Official Build) (arm64) )
- Node Version: 18.13.0
- Link to reproduction (
⚠️ read below): https://github.com/dskloetd/rollup-bug
Expected Behavior
All modules with circular dependencies should be wrapped in a "require wrapper".
Actual Behavior
The CommonJS plugin in rollup has a bug where it sometimes fails to detect a
circular dependency. The issue that this call to isCyclic
happens before the dependency graph is fully built and so
loadModule(resolved)
might be skipped while it shouldn't be.
And then getTypeForFullyAnalyzedModule
here
is called before the module is indeed fully analyzed. Then the module doesn't
get a "require wrapper" while it does need one.