Comments (3)
Hi @fuocor,
One thing that is important to note about cyclic dependencies is that once you mark a dependency as being "cyclic", rush will not locally link the dependency and instead it will attempt to install an acceptable version via NPM.
So in your example, when projb
marks proja
as being cyclic, Rush will attempt to install proja
from the registry. If you think about this, it makes sense: Rush needs to build the projects in the right order, and a cycle makes it impossible to know which project to build first. We break the cycle by effectively allowing one of the packages to depend on the previously published version of its dependency.
That being said, we definitely advise against using cyclic dependencies. We only use them in a handful of cases, such as in the web-build-tools repo where we want to build gulp-core-build
, node-library-build
, etc using the previous iteration of node-library-build
.
Generally speaking, it is fairly strange to have cyclic dependencies. May I ask what the intended purpose of the packages are (e.g. is proja a library and projb & projc applications)? We would be able to give an alternate suggestion around your code structure to ameliorate this problem.
from rushstack.
thanks for the response,
I noticed that it was being used in the ui-fabric-react codebase, and I thought I'd use it to manage some dependency injection requirements I have.
I already moved on to a more traditional consumer/provider approach with an abstract intermediary referenced by both (similar lo localization of resources).
The consumer is a composite made up of an arbitrary number of provider components. The problem I have is the sheer number of specialized providers (~3000 and growing). The configuration (JSON) is read at runtime, and flows through factories assembling the providers. If I pull everything in to resolve the configuration it costs me 4-5MB of minified code, which is a nightmare to compile, By having a cyclic dependency I could have defined the consumer interface implemented by the providers and rolled together when bundling.
I was hoping that perhaps you guys figured out a way to resolve exports prior to evaluating imports...
For the time being I bind the providers at runtime as external modules.
from rushstack.
rush will not locally link the dependency and instead it will attempt to install an acceptable version via NPM.
I have circular dependencies, as my projects are dog fooding each other.
As an example: I am making a library, and I'm making a documentation tool for documenting the library (or other libraries), and the documentation tool consumes said library in its implementation while the library depends on the doc tool for generation of documentation.
I think #1721 would be convenient to have in cases where the links are skipped, so then we can manually override and get back to work.
from rushstack.
Related Issues (20)
- [rush] browser-approved-packages.json is not updated when dependencies are removed HOT 2
- [rush] `rush install --only .` installs all dependencies in the monorepo instead of only the dependencies in current folder/project HOT 10
- [@rushstack/terminal] Remove support for the legacy `IColorableSequence` objects.
- [heft-jest] In watch mode, changedFiles should only remove files that match before/after the run HOT 1
- [heft-typescript] Bound current directory in sys.watchFile and sys.watchDirectory
- [rush] Make `install` and `update` log package manager to a file in common/temp
- [api-documenter]
- [rush] Find rush.json location by using 'dirname' at most 10 times HOT 8
- [api-extractor] Allow generation of API reports per release level HOT 1
- [api-extractor] Internal Error: Unable to follow symbol for "Set" HOT 1
- [eslint-patch] Upgrade to ESLint 9 HOT 4
- [rush] Latest Node LTS security patch for spawnSync breaks rush on Windows HOT 1
- [rush] Medium - <CVE-2024-28863> -6.5 - Vulnerability in βtar6.1.15β HOT 1
- [api-extractor] Union types extracted from declaration files are unstable
- [rush] tab-complete fails to complete project list after `--to` HOT 1
- [api-extractor] Better support for nominal types
- [rush] rush add -p <package> always installs as if `--all` is specified HOT 3
- [heft] `set-environment-variables-plugin` variables remain set in unrelated phases
- [rush] The source code address for the 'rush build' command.
- [rush] Cannot publish: getting ENEEDAUTH even though I'm already authenticated HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rushstack.