Document that package.json aliases may target only direct subfolders of src
This commit is contained in:
@@ -6,7 +6,16 @@ description: Shared code comes through # aliases in package.json imports, each d
|
||||
|
||||
Shared code is imported through Node subpath imports declared in
|
||||
`package.json` `imports`, never by a relative path that climbs out of a
|
||||
directory:
|
||||
directory.
|
||||
|
||||
**Targets (user rule, 2026-10-16):** an alias may point ONLY at a direct
|
||||
subfolder of `src/`: its `index.ts` (`"#helpers": "./src/helpers/index.ts"`)
|
||||
or a `#x/*` pattern inside that one folder. Never alias anything outside
|
||||
`src/` (`scripts/`, root files), `src/` itself (no `#plugin` for
|
||||
`./src/index.ts`), or a deeper folder (`./src/a/b/`). Code that would need
|
||||
such an alias uses a relative import instead; `scripts/` and
|
||||
`vite.config.ts` import each other relatively. Layer rules
|
||||
(`enforce-layer-order`) must still pass, so reorder entries if needed.
|
||||
|
||||
```jsonc
|
||||
"imports": {
|
||||
|
||||
Reference in New Issue
Block a user