You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Workspace boundary rules between packages (like turbo boundaries) #3295
As a developer moving a monorepo from Turborepo to Vite+, I want to declare which workspace packages may depend on which, and have a Vite+ command fail when a package breaks that, so our architecture rules keep being enforced in CI after turbo is gone.
We run turbo boundaries as a required CI step. Each package's turbo.json declares tags (backend, frontend, app), and the root has two rules:
"boundaries": {
"tags": {
// a backend package must never end up in a frontend bundle"backend": { "dependents": { "deny": ["frontend"] } },
// apps are dependency sinks, no app imports another app"app": { "dependents": { "deny": ["app"] } }
}
}
It also flags a file that imports a package not declared in its own package.json (cannot import package 'x' because it is not a dependency), which catches imports that only work because of hoisting. On our repo (88 packages, about 4,400 files) it runs in under a second.
Vite+ has nothing equivalent that we could find, so this is one of the things keeping turbo in our toolchain.
Suggested solution
Tags on workspace packages and allow/deny rules between them, checked against both package.json dependencies and actual imports. vp check seems like the natural home since it's already the CI gate, or a separate vp check --boundaries if it shouldn't run by default.
Config would sit naturally in the root vite.config.ts, with tags per package. Packages without a vite.config.ts (most of ours: NestJS backends and libraries) would need somewhere to put their tags, maybe a vite-plus field in package.json.
Alternative
Path-based lint rules in the style of ESLint's import/no-restricted-paths. They work on file paths, not package tags, so we'd keep a hand-written list per package.
dependency-cruiser or eslint-plugin-boundaries. Both work, but it's one more tool to configure, which is what we're trying to get away from.
What we did in the meantime: a ~340-line script that does turbo's three checks (relative imports leaving the package, undeclared package imports, tag rules over the dependency graph) and gives the same result as turbo boundaries on our repo. It works, but it's ours to maintain, and every team leaving turbo would write the same thing.
Exploration: No — this is a feature request, not a bug report, so exploration of root cause is not applicable
Unit Test: No — not applicable for a proposed feature
Priority:P2: Has Workaround. The reporter already maintains a custom script that replicates the requested turbo boundaries checks, and alternatives like dependency-cruiser or eslint-plugin-boundaries exist. This is an enhancement request rather than a defect.
This issue asks for a new Vite+ capability (workspace package tags and dependency-boundary enforcement) rather than reporting incorrect behavior in an existing feature. No reproduction of a bug is possible because the described behavior is desired new functionality.
I wasn't able to find a fix, but I identified some areas that may be relevant. If maintainers decide to pursue this enhancement, the likely integration points are the vp check command surface in packages/cli/src, the workspace/package.json parsing logic, and the Vite+ config schema in vite.config.ts. These are the places where tag configuration and import-graph validation would need to be wired in.
Title: Workspace boundary rules between packages (like turbo boundaries)
Reporter: ReemX
Status: open
The issue requests a new Vite+ feature equivalent to Turborepo's turbo boundaries command. The reporter wants to declare tags on workspace packages and define allow/deny rules between tags, then have a Vite+ command validate that:
Relative imports do not leave the package (cross-package imports are only via package names).
Packages cannot import another package unless it is declared in their own package.json dependencies (catching hoisted/phantom dependencies).
Tag-based dependency rules are enforced over the workspace dependency graph.
Suggested homes: vp check or vp check --boundaries. Configuration would be in vite.config.ts or a vite-plus field in package.json for packages without a Vite config.
This is a feature request, not a bug report.
Environment
Vite+ / vp: v1.4.0
Node.js: v24.22.1
Package manager: pnpm v12.11.2
OS: Linux x64 (GitHub Actions runner)
Relevant tools:
vite v8.3.5
rolldown v1.2.15
vitest v5.0.5
Reproduction Attempt
No reproduction was created because the issue does not describe a bug or incorrect behavior. It describes desired functionality that Vite+ currently lacks.
All version commands succeeded and show a healthy local Vite+ installation.
Control / validation
Searched the current checkout for any existing boundary-check functionality:
grep -R "boundaries" packages/cli/src crates/ docs/ 2>/dev/null | head -n 20
grep -R "enforce-module-boundaries". --include="*.ts" --include="*.md"2>/dev/null | head -n 10
No existing workspace-boundary enforcement feature was found. This confirms the issue is requesting new functionality rather than reporting a defect in existing functionality.
Result
Skipped: not-actionable
This issue is a feature request / enhancement proposal, not a Vite+ bug report. The reproduce stage is intended to determine whether a reported bug reproduces on the current checkout. Because no bug is described, no reproduction is possible or required at this stage.
Observations Useful for Diagnosis (if this reaches product/design)
The reporter explicitly compares the requested feature to Turborepo's turbo boundaries and Nx's @nx/enforce-module-boundaries.
Suggested integration points: vp check (as default or via --boundaries), config in root vite.config.ts, and per-package tags via a vite-plus field in package.json.
The current Vite+ workspace / monorepo tooling does not appear to provide an equivalent configuration surface.
No further auto-triage steps (diagnose/verify/fix) are appropriate for a feature request.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
+1 from a smaller setup: npm workspaces with linked installs, Vite+ as the only toolchain, TypeScript 7.
We enforce layer direction (domain imports no other package, libraries never import applications, applications never import each other) with dependency-cruiser next to vp check. It works, but on TypeScript 7 it needs @swc/core just to parse .ts, so it's two extra dependencies and a separate config for something that would sit naturally in vite.config.ts and vp check. Path- or tag-based allow/deny rules would cover our case.
The three checks split cleanly into two layers, and each fits a tool Vite+ already has.
1. Tag rules over the package graph: vite-task + vp check
These only need package.json dependencies, and vite-task already builds that graph for vp run. Config goes in the root vite.config.ts, with tags assigned by directory glob, so packages without a vite.config.ts (most NestJS backends and libraries) need nothing of their own:
The semantics are Turborepo's: dependencies / dependents with allow / deny per tag, checked over transitive workspace dependencies. A package can match several globs, and its tags are the union.
vp check runs it whenever boundaries is set, so it's part of the CI gate with no extra flag. It reads no source files, so it costs milliseconds.
Errors name the chain, e.g. apps/phoenix/frontend → @shared/frontend-api → @shared/backend-auth: a 'backend' package can't be a dependency of a 'frontend' package.
2. Import checks per file: Oxlint rules
"A relative import leaves its package" and "a bare import isn't declared in package.json" are per-file checks, so they belong in the linter as eslint-plugin-import's no-relative-packages and no-extraneous-dependencies. Both need the package's package.json in the linter, which is oxc-project/oxc#22364. I'd take that up with the Oxc team separately, so this issue only needs part 1.
What I'd send
vite-task: the tag-rule check in vt_workspace, with plan snapshots.
vite-plus: the boundaries config schema, the vp check step, and a docs section in the check guide.
Not included: per-file tag rules, tags in package.json, and turbo.json migration in vp migrate (it could read tags and boundaries from turbo.json later).
Questions before I start:
Is a top-level boundaries block in vite.config.ts OK, or should it go under run or check?
Should it run by default in vp check when configured, or only with vp check --boundaries?
Directory globs for tags, or would you rather have tags next to each package (a vite-plus field in package.json)? Globs keep everything in one file; per-package tags are what Turborepo does.
For scale: our version of part 1 is about 60 lines on top of the workspace graph and gives the same result as turbo boundaries on 88 packages. filipfalcon's case above (layer direction on npm workspaces, now done with dependency-cruiser) is the same rule set.
Activity
voidzero-bot commentedon Oct 31, 2026
turbo boundarieschecks, and alternatives likedependency-cruiseroreslint-plugin-boundariesexist. This is an enhancement request rather than a defect.This issue asks for a new Vite+ capability (workspace package tags and dependency-boundary enforcement) rather than reporting incorrect behavior in an existing feature. No reproduction of a bug is possible because the described behavior is desired new functionality.
I wasn't able to find a fix, but I identified some areas that may be relevant. If maintainers decide to pursue this enhancement, the likely integration points are the
vp checkcommand surface inpackages/cli/src, the workspace/package.json parsing logic, and the Vite+ config schema invite.config.ts. These are the places where tag configuration and import-graph validation would need to be wired in.Full Triage Report
Triage Report: Issue #3295
Issue Summary
Title: Workspace boundary rules between packages (like
turbo boundaries)Reporter: ReemX
Status: open
The issue requests a new Vite+ feature equivalent to Turborepo's
turbo boundariescommand. The reporter wants to declare tags on workspace packages and define allow/deny rules between tags, then have a Vite+ command validate that:package.jsondependencies (catching hoisted/phantom dependencies).Suggested homes:
vp checkorvp check --boundaries. Configuration would be invite.config.tsor avite-plusfield inpackage.jsonfor packages without a Vite config.This is a feature request, not a bug report.
Environment
Reproduction Attempt
No reproduction was created because the issue does not describe a bug or incorrect behavior. It describes desired functionality that Vite+ currently lacks.
Commands attempted
All version commands succeeded and show a healthy local Vite+ installation.
Control / validation
Searched the current checkout for any existing boundary-check functionality:
No existing workspace-boundary enforcement feature was found. This confirms the issue is requesting new functionality rather than reporting a defect in existing functionality.
Result
Skipped:
not-actionableThis issue is a feature request / enhancement proposal, not a Vite+ bug report. The reproduce stage is intended to determine whether a reported bug reproduces on the current checkout. Because no bug is described, no reproduction is possible or required at this stage.
Observations Useful for Diagnosis (if this reaches product/design)
turbo boundariesand Nx's@nx/enforce-module-boundaries.vp check(as default or via--boundaries), config in rootvite.config.ts, and per-package tags via avite-plusfield inpackage.json.This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
filipfalcon commentedon Nov 5, 2026
+1 from a smaller setup: npm workspaces with linked installs, Vite+ as the only toolchain, TypeScript 7.
We enforce layer direction (domain imports no other package, libraries never import applications, applications never import each other) with dependency-cruiser next to
vp check. It works, but on TypeScript 7 it needs@swc/corejust to parse.ts, so it's two extra dependencies and a separate config for something that would sit naturally invite.config.tsandvp check. Path- or tag-based allow/deny rules would cover our case.ReemX commentedon Nov 21, 2026
@fengmk2, a concrete proposal so this has something to say yes or no to. I'd implement it, as with voidzero-dev/vite-task#1009.
The three checks split cleanly into two layers, and each fits a tool Vite+ already has.
1. Tag rules over the package graph: vite-task +
vp checkThese only need
package.jsondependencies, and vite-task already builds that graph forvp run. Config goes in the rootvite.config.ts, with tags assigned by directory glob, so packages without avite.config.ts(most NestJS backends and libraries) need nothing of their own:dependencies/dependentswithallow/denyper tag, checked over transitive workspace dependencies. A package can match several globs, and its tags are the union.vp checkruns it wheneverboundariesis set, so it's part of the CI gate with no extra flag. It reads no source files, so it costs milliseconds.apps/phoenix/frontend → @shared/frontend-api → @shared/backend-auth: a 'backend' package can't be a dependency of a 'frontend' package.2. Import checks per file: Oxlint rules
"A relative import leaves its package" and "a bare import isn't declared in
package.json" are per-file checks, so they belong in the linter as eslint-plugin-import'sno-relative-packagesandno-extraneous-dependencies. Both need the package'spackage.jsonin the linter, which is oxc-project/oxc#22364. I'd take that up with the Oxc team separately, so this issue only needs part 1.What I'd send
vt_workspace, with plan snapshots.boundariesconfig schema, thevp checkstep, and a docs section in the check guide.package.json, andturbo.jsonmigration invp migrate(it could readtagsandboundariesfromturbo.jsonlater).Questions before I start:
boundariesblock invite.config.tsOK, or should it go underrunorcheck?vp checkwhen configured, or only withvp check --boundaries?vite-plusfield inpackage.json)? Globs keep everything in one file; per-package tags are what Turborepo does.For scale: our version of part 1 is about 60 lines on top of the workspace graph and gives the same result as
turbo boundarieson 88 packages. filipfalcon's case above (layer direction on npm workspaces, now done with dependency-cruiser) is the same rule set.