feat(bolt-vite-react-ts): add @/ path alias for src#116
Merged
Conversation
Configure a depth-invariant @/* -> src/* alias in both tsconfig.app.json (paths + baseUrl) and vite.config.ts (resolve.alias) so cross-module imports can be written @/services/foo instead of ../../services/foo. Removes the miscounted-relative-depth import errors that agents hit on deep folder layouts.
|
|
…prompt Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a depth-invariant
@/*→src/*path alias to thebolt-vite-react-tsstarter, wired in both places Vite + tsc need it:tsconfig.app.json:baseUrl+pathsvite.config.ts:resolve.aliasPlus one line in the starter's
.bolt/promptsteering the agent to prefer@/imports over deep relative paths — co-located with the alias it describes, following the existing template-prompt convention.Verified:
@/-prefixed imports resolve under bothnpm run typecheck(tsc) andnpm run build(vite).Why
On deep folder layouts, the agent (GLM-5.2 especially) miscounts relative import depth —
../services/xvs../../services/x— against a file that exists, forcing build-failure repair loops. Measured on thesalamtak-cliniceval: ~1 unresolvable-import build failure per run, from 237 relative cross-directory imports. A@/alias is depth-invariant (@/services/xis the same from any file), removing the class structurally when the agent adopts it.Paired with an OSS-gated import-discipline prompt block (bolt PR #6519). Validated via an eval that points
templates.jsonat this branch's head: GLM import-failures → 0 across all 20 build specs, no regression for Sonnet.Blast radius
Additive and backwards-compatible — existing relative imports keep working; the alias is simply also available. The prompt line only affects new projects scaffolded from this template.