Skip to content

build/test fails on clean env for workspaces with cross-dependencies #173

@Reversean

Description

@Reversean

Problem

When running build:modified or test:modified on a clean environment (fresh checkout, no dist/ present), any workspace that depends on another workspace will fail.

Root cause

yarn workspaces foreach --since -Rpt run build will affect modified workspaces and its dependants, but not dependencies. vite build and vitest resolve workspace imports using the main/module/exports fields in package.json, which all point to dist/. On a clean checkout dist/ does not exist, so build or test of modified workspaces with cross-dependencies on unmodified workspaces fails immediately.

Example

packages/core           (no workspace deps)
packages/javascript     (depends on @hawk.so/core)
packages/sveltekit      (depends on @hawk.so/javascript)

Change only packages/javascript. --since -R selects javascript + sveltekit. Build order: javascriptsveltekit.

  • packages/javascript tries to import @hawk.so/core → resolves to packages/core/dist/not found → build fails
  • packages/sveltekit is never reached

Same issue for vitest: even though @hawk.so/core is not in the --since set, the test runner still needs to resolve it.

Impact

  • build:modified and test:modified are broken on CI (fresh checkout) whenever a changed workspace has workspace dependencies that are not themselves changed
  • Developers on a clean clone must manually run build:all before build:modified or test:modified can work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions