|
|
|
|
|
by acemarke
1499 days ago
|
|
`npm link` and symlinks often end up causing multiple copies of a transitive dependency to end up in the final build. This is especially bad if you're using something like React, which depends on singleton modules to do much of its work, and starts failing if multiple copies of React have been loaded in. If you're working on a React-based library, you'd normally have React installed in the lib repo as a dev dependency. But, when you go to test out that lib in a sample app repo, you don't want to accidentally have both the app repo's copy of React _and_ the lib repo's copy of React - you want just the app repo's copy. So yeah, using Yalc technically requires a couple of additional steps ( `yalc publish` in the lib repo, `yalc add my-lib && yarn` in the sample repo), but it's consistent and it _works_. It also correctly handles the fact that you are doing both a build step and only publishing certain folders. I've caught a couple bugs that I would have otherwise shipped to NPM as a result of using Yalc for local testing. |
|