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

[BUG] the package isn't compatible with Rollup due to require cycle #381

Open
Tracked by #501
thorn0 opened this issue May 10, 2021 · 6 comments
Open
Tracked by #501

[BUG] the package isn't compatible with Rollup due to require cycle #381

thorn0 opened this issue May 10, 2021 · 6 comments
Labels
Bug thing that needs fixing semver:major backwards-incompatible breaking changes
Milestone

Comments

@thorn0
Copy link

thorn0 commented May 10, 2021

What / Why

Rollup breaks this package when bundling it.

When

Since 2021-07-05 when @rollup/plugin-commonjs 19.0.0 has been released.

How

Current Behavior

semver.satisfies always returns false after bundling with Rollup.

Steps to Reproduce

Expected Behavior

Bundled and unbundled code should work the same way.

References

@aurelhann
Copy link

Any news or working workaround ?

@ljharb
Copy link

ljharb commented Aug 24, 2021

Sounds like you need to file a bug on rollup then?

@Idered
Copy link

Idered commented Sep 25, 2021

Importing one by one fixed this for me:

import maxSatisfying from "semver/ranges/max-satisfying";
import minSatisfying from "semver/ranges/min-satisfying";
import coerce from "semver/functions/coerce";

@himanshusinghs
Copy link

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?

@lukekarrys lukekarrys changed the title [BUG] the package isn't compatible with Rollup [BUG] the package isn't compatible with Rollup due to require cycle Feb 26, 2022
@hadfieldn
Copy link

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.

sam-b-rose added a commit to sam-b-rose/vscode-languageserver-node that referenced this issue May 24, 2022
A circular dependency between the Range and Comparator classes can cause
issues for consumers who are trying to bundle extensions with
vscode-languageclient as a dependency.

See related GitHub issue from [npm/node-semver](https://github.com/npm/node-semver)

- [[BUG] the package isn't compatible with Rollup due to require cycle microsoft#381](npm/node-semver#381)
dbaeumer pushed a commit to microsoft/vscode-languageserver-node that referenced this issue Jun 22, 2022
A circular dependency between the Range and Comparator classes can cause
issues for consumers who are trying to bundle extensions with
vscode-languageclient as a dependency.

See related GitHub issue from [npm/node-semver](https://github.com/npm/node-semver)

- [[BUG] the package isn't compatible with Rollup due to require cycle #381](npm/node-semver#381)
bkleiner added a commit to OpenVTx/Openvtx-configurator that referenced this issue Jun 25, 2022
@rosefang
Copy link

rosefang commented Jun 28, 2022

Importing one by one fixed this for me:

import maxSatisfying from "semver/ranges/max-satisfying";
import minSatisfying from "semver/ranges/min-satisfying";
import coerce from "semver/functions/coerce";

thanks.
I fixed the problem use this solution. But, I don't understand why. Can you explain it?
@Idered Idered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing semver:major backwards-incompatible breaking changes
Projects
None yet
Development

No branches or pull requests

9 participants