Lynch
Lynch

Reputation: 101

how to run watch script in pnpm workspace

If I have structure like this

packages
  - alice
  - bar
  - foo
package.json

alice, bar, foo are three sub packages. bar is the dependency of alice. Every sub package has its own watch script defined in package.json. Now, I add a script likepnpm -r run watch, it will get stuck, because watch script won't finished and pnpm awaits each command to finish before running the next. So we can add parallel to run them in parallel, like pnpm -r --parallel run watch, but it still get error in the first run, because bar isn't finished, alice can't resolve bar correctly. see github

So is there any workarounds to make this work.

I find Manage Monorepo with pnpm, he got the same issue, and I think he didn't find a elegant way to solve this.

And I find the vitest use pnpm -r --parallel --filter=./packages/** run dev, and it works, I have no idea why vitest just works

Upvotes: 8

Views: 3611

Answers (0)

Related Questions