-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Verify canary release
- I verified that the issue exists in the latest Turborepo canary release.
Link to code that reproduces this issue
https://github.com/mentimeter/turborepo-boundaries-example
Which canary version will you have in your reproduction?
turbo@2.8.11-canary.4
Environment information
CLI:
Version: 2.8.11-canary.4
Path to executable: /Users/charlotte.andersson/workspace/my-turborepo/node_modules/turbo-darwin-arm64/bin/turbo
Daemon status: Running
Package manager: yarn
Platform:
Architecture: aarch64
Operating system: macos
WSL: false
Available memory (MB): 2943
Available CPU cores: 10
Environment:
CI: None
Terminal (TERM): xterm-256color
Terminal program (TERM_PROGRAM): iTerm.app
Terminal program version (TERM_PROGRAM_VERSION): 3.5.14
Shell (SHELL): /bin/zsh
stdin: false
Expected behavior
turbo boundaries should either:
- Read and respect tsconfig.json path aliases when resolving imports, or
- Provide a config option in turbo.json to declare known path prefixes as local (e.g. ignoredImports: ["features/*"])
Actual behavior
turbo boundaries reports violations for imports that use TypeScript path aliases resolving to local source folders, treating them as undeclared package dependencies.
Example:
tsconfig.json in apps/app-a:
{
"compilerOptions": {
"paths": {
"*": [
"./src/*"
],
},
}
}
A source file importing:
import { feature_A } from "features/feature-a";
This resolves to ./src/features/feature-a -> it is entirely local to the workspace. TypeScript resolves it correctly. However, turbo boundaries flags it as:
Checking packages...
× cannot import package `features` because it is not a dependency
╭─[/Users/charlotte.andersson/workspace/my-turborepo/apps/app-a/src/index.ts:1:
add workflow run
1]
1 │ import { feature_A } from "features/feature-a";
· ───────────────────────┬───────────────────────
· ╰── package imported here
2 │
╰────
Checked 2 files in 5 packages, 1 issue found
To Reproduce
- Clone the example repo.
- Install dependencies.
- Open apps/app-a/src/index.ts.
- Note the import from "features/..." which resolves to a local src folder via tsconfig path alias.
- Run
yarn turbo boundaries - Observe the error: “cannot import package features because it is not a dependency” even though the import is local and resolvable by TypeScript.
Also runs in CI: https://github.com/mentimeter/turborepo-boundaries-example/actions/workflows/boundaries.yml
Additional context
Upgrading version by version, it seems it was introduced in turbo@v2.8.7, since turbo@v2.8.6 shows no issues found.
Current workaround: npx @turbo/codemod migrate --to 2.8.6