Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

there's a circular dependency #16

Open
mreinstein opened this issue Feb 22, 2019 · 7 comments
Open

there's a circular dependency #16

mreinstein opened this issue Feb 22, 2019 · 7 comments

Comments

@mreinstein
Copy link

expression.ts -> variable.ts -> expression.ts

@mreinstein
Copy link
Author

which is causing errors in bundling via rollup
screen shot 2019-02-22 at 1 35 28 pm

@IjzerenHein
Copy link
Owner

I know, it's been in there for a long time. Is it causing problems for you?

@mreinstein
Copy link
Author

actually it appears that rollup is able to deal with this, it isn't causing breakage. It would be a nice design thing to fix, but not nearly as critical as I initially thought.

@IjzerenHein
Copy link
Owner

Agreed. I Checked the code but couldn't find a quick solution. I guess it would require merging some files to resolve this issue, but I doubt that is what we want.

@leeoniya
Copy link

see rollup/rollup#2271 for workaround

@adamhaile
Copy link
Contributor

adamhaile commented Feb 27, 2019

My understanding is that circular dependencies are a warning in rollup (yellow), not an error (red), because in a lot of cases they're fine. For instance, they're touted by the rollup docs as a feature that es6 modules have over CommonJS. Rollup can't (yet) distinguish the ok cases from the not ok, so it currently always warns.

The usage here, between expression.ts and variable.ts, looks fine to me. I propose closing?

@mreinstein
Copy link
Author

I Checked the code but couldn't find a quick solution.

@IjzerenHein we could eliminate the circular dependency by moving the Variable.plus, Variable.minus, Variable.multiply, and Variable.divide functions into Expression. Those are the only references to expressions from with the variable module. And since they are creating expressions it might be reasonable to put them there anyway. perhaps the function prototype changes from

minus( value: number|Variable|Expression ): Expression

to

minus( value: number|Variable|Expression,  value2: number|Variable|Expression ): Expression`)

I realize this might be controversial as it would be a major api semver bump for the sake of fixing a non-critical bundling error, but it wouldn't be hard to do this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants