这是indexloc提供的服务,不要输入任何密码
Skip to content

Pass the --filter flag to a with task #10648

Answered by GaneshVarma1
bombillazo asked this question in Help
Discussion options

You must be logged in to vote

Hi @bombillazo You're asking a great question — right now, with tasks in Turborepo don't automatically receive the CLI flags (like --filter) passed to the parent task.

What's happening

When you define:

"dev": {
  "with": ["//#watch"]
}

The watch task gets triggered internally, but Turbo doesn't forward any CLI args like --filter or --force to that task by default.


Workaround 1: Use a wrapper script

Instead of relying purely on with, you can create a small wrapper task or script that forwards process.argv:

Example in your package.json:

{
  "scripts": {
    "dev": "node ./scripts/dev.js"
  }
}

Then in scripts/dev.js:

const { execSync } = require("child_process");

const args = process.argv.s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bombillazo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants