Question about using yalc with monorepo/workspaces and many apps
See original GitHub issueHi!
I have a monorepo with about 40 components, and I’m using yarn workspaces to deal with dependencies, my folder structure and yarn are like this:
// folder structure
packages/comp1
packages/comp1/packages.json
packages/comp2
packages/comp2/packages.json
packages/comp3
packages/comp3/packages.json
// packages.json
"workspaces": [
"packages/*"
],
Then I have a test application, in another directory.
So to get everything working, I would link the componentes one by one running yarn link inside their folder.
In the application, run yarn install and after that I used to link all the packages comp1, comp2, comp3 to the application using yarn link comp1. Finally when I’v run the application I could change the components and test them perfectly.
But with that process, I only had the package linked and not is dependencies, so if I go to comp1, and update one of they’r dependencies, the link will not find the new dependency.
After a little search I’v came across yalc, and tried to use it but without success. With this structure I have, how should I use yalc?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (4 by maintainers)
Top Related StackOverflow Question
@whitecolor like @lipedeitos said, I’m only using this for development purposes for a react library, that I is built with rollup before linking. In production yarn/yalc link are not used.
What you said is correct about the workspace packages, everything is being lifted up to the top level of the node_modules as you would expect with workspaces. What I was trying to point out (not very well) is that I expected
yarn linkandyalc linkto work similarly after initial install, and create a symlink.for example purposes if I do:
yarn link corecreates symlinknode_modules/core --> [LOCAL_PATH]/coreyalc link corecreates .yalc/core folder, DOES NOT create symlinknode_modules/core --> ../.yalc/coremy work around for the above is to manually symlink my core folder to the .yalc folder.
mv node_modules/core node_modules/core.bck && cd node_modules && ln -s ../.yalc/core ./coreMaybe yalc is behaving correctly, I was just basing all this off of what it does when not using workspaces. If this is case, please let me know and i’ll look for an alternative solution.
after @lipedeitos second explanation it sounds like we are actually having different issues, sorry I hijacked the thread, seemed like we were having the same issue originally.
What is
yalchere for?You should update package dependencies in linked app.