You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] the package isn't compatible with Rollup due to require cycle #381
Reacted by Saran Tanpituckpong ✔️, Alex Kozack, yoyoIU, Ian K Smith, Miklos Megyes, Himanshu Singh, Nathan Hadfield, Sam Rose, Andrew Sullivan, Eyal and 1 more
Facing the issue when trying to rollup a fastify server which depends on this package. If what @Idered mentioned is correct then I suppose the fix has to go to the packages that depends on semver, fastify in my case? Does anyone have more insight on what is going wrong?
changed the title [-][BUG] the package isn't compatible with Rollup[/-][+][BUG] the package isn't compatible with Rollup due to require cycle[/+]on Feb 26, 2022
Ran into this issue today. Not a blocker for us but it would be nice to eliminate the cycle warning. Wondering if the solution proposed by @lukastaegert has been considered/attempted? (It doesn't appear that it has.)
I suppose the main issue is creating a breaking change for third-party code that imports Range and Comparator. Unfortunately I'm not familiar enough with this library yet to know what that impact would likely be, and what the workarounds might be.
Activity
aurelhann commentedon Aug 24, 2021
Any news or working workaround ?
ljharb commentedon Aug 24, 2021
Sounds like you need to file a bug on rollup then?
Idered commentedon Sep 25, 2021
Importing one by one fixed this for me:
himanshusinghs commentedon Jan 24, 2022
Facing the issue when trying to rollup a fastify server which depends on this package. If what @Idered mentioned is correct then I suppose the fix has to go to the packages that depends on semver, fastify in my case? Does anyone have more insight on what is going wrong?
[-][BUG] the package isn't compatible with Rollup[/-][+][BUG] the package isn't compatible with Rollup due to require cycle[/+]hadfieldn commentedon May 3, 2022
Ran into this issue today. Not a blocker for us but it would be nice to eliminate the cycle warning. Wondering if the solution proposed by @lukastaegert has been considered/attempted? (It doesn't appear that it has.)
I suppose the main issue is creating a breaking change for third-party code that imports Range and Comparator. Unfortunately I'm not familiar enough with this library yet to know what that impact would likely be, and what the workarounds might be.
Avoid circular dependencies in SemVer (#957)
workaround dependency cycle in node-semver
rosefang commentedon Jun 28, 2022
thanks.
I fixed the problem use this solution. But, I don't understand why. Can you explain it?
@Idered Idered
mbtools commentedon May 21, 2026
This was 5y ago.
I tested this with latest version of rollup (4.60.4), the plugins, and semver. It now works correctly.
I suggest closing this issue.
Before
https://github.com/thorn0/rollup-commonjs-semver-issue
After
https://github.com/mbtools/rollup-commonjs-semver-issue
You do get a message about the circular dependency but the bundled code works fine: