Repository navigation
Commit fdcfcee
authored
docs: recommend install-strategy=linked to catch phantom dependencies (#9678)
Encourages package authors to develop under `install-strategy=linked` to
surface undeclared ("phantom") dependencies before publishing.
Under the default hoisted `node_modules`, a package can `import` a
dependency it never declared and still resolve it: a transitive
dependency hoisted alongside it (or a workspace root's `node_modules`)
happens to satisfy the import. That undeclared dependency passes the
author's own build silently, then fails for a consumer who installs the
package on its own. The linked (isolated) layout exposes only a
package's declared dependencies, so such an import can fail at the
author's build instead of shipping broken.
The change documents this in two places:
- The `install-strategy` entry in the config reference now recommends
that authors use `--install-strategy=linked` during development,
cross-linked to the developers guide.
- The Developers guide gains a "Catching undeclared ("phantom")
dependencies" section under "Before Publishing", with a note that this
is one check — a dependency satisfied by a `devDependency` or a
workspace root's `node_modules` can still resolve locally — alongside
auditing the dependencies the published package actually uses.
This is documentation-only; the config reference text is generated from
the `install-strategy` definition description.
## References
Closes #96751 parent 86416a6 commit fdcfcee
3 files changed
Lines changed: 34 additions & 0 deletions
File tree
- docs/lib/content/using-npm
- tap-snapshots/test/lib
- workspaces/config/lib/definitions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
174 | 192 | | |
175 | 193 | | |
176 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1192 | 1192 | | |
1193 | 1193 | | |
1194 | 1194 | | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
1195 | 1203 | | |
1196 | 1204 | | |
1197 | 1205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1281 | 1289 | | |
1282 | 1290 | | |
1283 | 1291 | | |
| |||
0 commit comments