Skip to content

Commit 180c581

Browse files
committed
docs: update docs about symlinked node_modules
1 parent ec0e40d commit 180c581

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

docs/symlinked-node-modules-structure.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ node_modules
2323
└── .pnpm
2424
2525
│ └── node_modules
26-
│ └── bar -> <store>/bar
27-
│ ├── index.js
28-
│ └── package.json
26+
│ └── bar
27+
│ ├── index.js -> <store>/001
28+
│ └── package.json -> <store>/002
2929
3030
└── node_modules
31-
└── foo -> <store>/foo
32-
├── index.js
33-
└── package.json
31+
└── foo
32+
├── index.js -> <store>/003
33+
└── package.json -> <store>/004
3434
```
3535

3636
These are the only "real" files in `node_modules`. Once all the packages are
@@ -55,10 +55,10 @@ node_modules
5555
└── .pnpm
5656
5757
│ └── node_modules
58-
│ └── bar -> <store>/bar
58+
│ └── bar -> <store>
5959
6060
└── node_modules
61-
├── foo -> <store>/foo
61+
├── foo -> <store>
6262
└── bar -> ../../[email protected]/node_modules/bar
6363
```
6464

@@ -71,10 +71,10 @@ node_modules
7171
└── .pnpm
7272
7373
│ └── node_modules
74-
│ └── bar -> <store>/bar
74+
│ └── bar -> <store>
7575
7676
└── node_modules
77-
├── foo -> <store>/foo
77+
├── foo -> <store>
7878
└── bar -> ../../[email protected]/node_modules/bar
7979
```
8080

@@ -90,16 +90,16 @@ node_modules
9090
└── .pnpm
9191
9292
│ └── node_modules
93-
│ ├── bar -> <store>/bar
93+
│ ├── bar -> <store>
9494
│ └── qar -> ../../[email protected]/node_modules/qar
9595
9696
│ └── node_modules
97-
│ ├── foo -> <store>/foo
97+
│ ├── foo -> <store>
9898
│ ├── bar -> ../../[email protected]/node_modules/bar
9999
│ └── qar -> ../../[email protected]/node_modules/qar
100100
101101
└── node_modules
102-
└── qar -> <store>/qar
102+
└── qar -> <store>
103103
```
104104

105105
As you may see, even though the graph is deeper now (`foo > bar > qar`), the
@@ -117,4 +117,8 @@ dependencies are accessible. With a flattened `node_modules` structure, all
117117
hoisted packages are accessible. To read more about why this is an advantage,
118118
see "[pnpm's strictness helps to avoid silly bugs][bugs]"
119119

120+
Unfortunately, many packages in the ecosystem are broken — they use dependencies that are not listed in their `package.json`. To minimize the number of issues new users encounter, pnpm hoists all dependencies by default into `node_modules/.pnpm/node_modules`. To disable this hoisting, set [hoist] to `false`.
121+
122+
[hoist]: settings.md#hoist
123+
120124
[bugs]: https://www.kochan.io/nodejs/pnpms-strictness-helps-to-avoid-silly-bugs.html

0 commit comments

Comments
 (0)