-
Notifications
You must be signed in to change notification settings - Fork 105
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
Rollup plugin Circular Dependency issue #99
Comments
Hi, could you post a reproduction case please - some code I can debug and fix. Thanks. |
Thanks for looking into this. https://github.com/dananderson/command-line-args-cicular-dependency
My rollup target environment is node with es6 classes. rollup produces one.js with a circular dependency warning. one.js is created, but running one.js results in a runtime error due to the circular dependency. |
thanks for the reproduction case. The option-flag module is lazy-loaded at run time therefore does not cause a compile-time circular reference. This is a rollup issue caused by a bug in rollup-plugin-commonjs. Do you have a quick fix for this? If so, please drop me a PR. The long-term fix is to upgrade the command-line-args project to offer an ESM entry-point (as well as CJS). I'll do that when I next get chance. |
Thanks for digging into the rollup stuff. The root cause seems to be how rollup translates inline requires. I suspect it is not worth fixing on the rollup side because user land expects the existing behavior.. and es modules are coming. The long term fix would be an es module. For the short term, it would be nice to get command-line-args working with rollup. I'll propose a PR next week and we can discuss if it fits into your project. |
Fixed and released in v5.1.0. |
command-line-args caused this error with rollup:
(!) Circular dependency: node_modules/command-line-args/lib/option.js -> node_modules/command-line-args/lib/option-flag.js -> node_modules/command-line-args/lib/option.js
A fix would be to move Option/OptionFlag.create to a new OptionFactory class file and update create callers to use the factory.
The text was updated successfully, but these errors were encountered: