wclr / yalc

Work with yarn/npm packages locally like a boss.
MIT License
5.52k stars 146 forks source link

`yalc link` broken after adding/removing packages #209

Open feightwywx opened 1 year ago

feightwywx commented 1 year ago

Hi everyone, I'm using yalc to link my react component library to my project, it's amazing and far better than original yarn link until I add a package using yarn add.

For example, assuming my-project as a project and my-package as a package linked to the project. Everything works well. But after adding something to my project:

yarn add some-package

build, and react complained this:

error - Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

However, the resolution is running the following commands:

# at /my-package
yalc installations clean my-package
yalc publish

# at /my-project
yalc remove --all
yalc link my-pakcage

Only re-publishing or only re-linking takes no effect. I'm not sure is there any mistake in my use. Is this a bug, or just a designed behavior?