Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turbo watch wrong hash #9104

Open
1 task done
vekexasia opened this issue Sep 3, 2024 · 6 comments
Open
1 task done

turbo watch wrong hash #9104

vekexasia opened this issue Sep 3, 2024 · 6 comments
Labels
area: docs Improvements or additions to documentation

Comments

@vekexasia
Copy link

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

turborepo/examples/with-rollup

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Linux

Which canary version will you have in your reproduction?

2.1.1

Describe the Bug

i tried the with-rollup example as it aligns with my use case.

steps:

  • npx turbo build
  • edit packages/ui/.eslintrc.cjs add a new line and save
  • npx turbo build

this gives FULL TURBO ->>> Ok

now:

  • npx turbo watch build
  • make same edit

this gives a cache miss with a different hash and rebuilds

notes: if from here you npx turbo build again. the hash is the same as in the first steps

Expected Behavior

cache hits like in turbo build

To Reproduce

  • clone turborepo
  • cd examples/with-rollup
  • pnpm i

Additional context

No response

@vekexasia vekexasia added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Sep 3, 2024
@chris-olszewski
Copy link
Member

turbo watch does make use of the cache to prevent any partial artifacts from being stored in the cache. I see this isn't documented anywhere so I'll quick add it.

@chris-olszewski chris-olszewski added area: docs Improvements or additions to documentation and removed kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Sep 4, 2024
@vekexasia
Copy link
Author

What is the proper way to have a watch rebuild + subdeps?

@chris-olszewski
Copy link
Member

I don't believe I understand your question. Could you elaborate a bit?

@vekexasia
Copy link
Author

I would like something like watch that honors the inputs of the task so that it triggers only when something matching the inputs changes.

@MarkParnwell
Copy link

I believe I am having the same issue of turbo watch not respecting task inputs.

Given a turbo.json like below

{
  "$schema": "https://turbo.build/schema.json",
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "inputs": ["$TURBO_DEFAULT$", "src/**/*.ts", "!src/**/*.spec.ts"],
      "outputs": ["dist/**"]
    }
  }
}

When I run turbo run build, change a test file and run turbo run build again, I get

 Tasks:    3 successful, 3 total
Cached:    3 cached, 3 total
  Time:    90ms >>> FULL TURBO

However, when I run turbo watch build and change a test file, the build task is re-executed each time.

@choover-circle
Copy link

I think this issue is right spirit but wrong to approach this as a bug but as a feature request since turbo documentation explicitly states that caching is disabled for tasks running with watch.

I would like to infact use caching with turbo watch.

My ideal behavior is that when running with turbo watch, the first run is like with turbo run where tasks that miss cache are run. After that, I would like it to watch the inputs and re-run tasks for which inputs changed.

Is this currently on a roadmap? Is caching disabled for now because its a planned feature or is there some technical limitation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants