turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Watch-mode not rebuild dependent packages when package changes

Open weyert opened this issue 1 month ago • 23 comments

Verify canary release

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

Link to code that reproduces this issue

n/a

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

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

1.13.4-canary.4

Describe the Bug

If you make a change to a package that an project is depending on the project does not get rebuild

Expected Behavior

I would expect that the project gets rebuild when the package this project depends on get changed

To Reproduce

If you have a project1 that depends on package1, and package2. The project1 has a script defined in its package.json named dev and the package1 and package2 workspace packages have script defined named build.

The dev in turbo.json is defined as:

{
  "pipeline": {
    "build": {
      "dependsOn": [
        "^build"
      ],
      "inputs": [
        "src/**",
        "public/**",
        "test/**",
        "migration/**",
        "patches/**",
        "mocks/**",
        "__mocks__/**",
        // Required to ignore .DS_Store files
        "!dist/**",
        "!lib/**",
        "!coverages/**",
        "!**/.DS_Store"
      ],
      "outputs": [
        "dist/**/*",
        "build/**/*",
        "lib/**/*",
        "typings/**/*",
        ".next/**/*",
        "!.next/cache/**"
      ],
      "outputMode": "new-only"
    },
    "dev": {
      "dependsOn": [
        "^build"
      ],
      "cache": false,
      "persistent": true
    }
  }
}

If I run the command turbo watch dev --filter=project1 all the packages get build and the dev-script of project1 gets started. Now if I make a change to package1 e.g. src/index.ts. The Turborepo daemon detects the following:

2024-05-16T22:03:07.792779Z  WARN turborepo_lib::package_changes_watcher: changed_files: {AnchoredSystemPathBuf("packages/logging/src/ConsoleStructuredLogger.ts")}
2024-05-16T22:03:07.792801Z  WARN turborepo_lib::package_changes_watcher: changed_packages: Ok(Some({WorkspacePackage { name: Other("@company/logging"), path: AnchoredSystemPathBuf("packages/logging") }}))

So it appears that Turborepo has picked up that the package has changed but it doesn't seem to trigger build on the package and then after that completes re-runs the dev-script of project1.

Have I misconfigured my project?

Additional context

No response

weyert avatar May 16 '24 22:05 weyert