Commit 0df1541
Disable global package resolution by default
Summary:
Prior to Metro symlink support, many users relied on "global package" resolution in setups such as Yarn workspaces. With global packages, any `package.json` *outside* `node_modules` may be resolved by name from anywhere in the project.
In the case of Yarn (etc.) workspaces, we're now able to resolve the same packages through the symlinks the packager creates under `node_modules`, in the same manner as Node JS and other tooling does.
Global packages now provide little value for most users, and in fact are a potential footgun - if your global package happens to share its name with a `node_modules` package, the former will always take precedence, even when resolving relative to another `node_modules` package.
This changes the default for `resolver.enableGlobalPackages` to `false`. If you require global packages, you will need to explicitly enable them in your config.
Changelog
```
- **[Breaking]:** Disable global package resolution (`resolver.enableGlobalPackages`) by default
```
Reviewed By: motiz88
Differential Revision: D48777893
fbshipit-source-id: 23b8a5884582e20ca92c8356e67909f2d66b9e7b1 parent 9e7cec1 commit 0df1541
File tree
5 files changed
+58
-43
lines changed- docs
- packages
- metro-config/src
- __tests__/__snapshots__
- defaults
- metro/src/DeltaBundler/__tests__
- __snapshots__
5 files changed
+58
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 250 | + | |
255 | 251 | | |
256 | 252 | | |
257 | 253 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | | - | |
| 586 | + | |
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| |||
248 | 255 | | |
249 | 256 | | |
250 | 257 | | |
251 | | - | |
| 258 | + | |
252 | 259 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
257 | 271 | | |
258 | 272 | | |
259 | 273 | | |
| |||
Lines changed: 28 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1633 | 1633 | | |
1634 | 1634 | | |
1635 | 1635 | | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
1644 | 1640 | | |
1645 | | - | |
1646 | | - | |
| 1641 | + | |
1647 | 1642 | | |
1648 | 1643 | | |
1649 | 1644 | | |
| |||
1843 | 1838 | | |
1844 | 1839 | | |
1845 | 1840 | | |
1846 | | - | |
| 1841 | + | |
1847 | 1842 | | |
1848 | 1843 | | |
1849 | 1844 | | |
| |||
1989 | 1984 | | |
1990 | 1985 | | |
1991 | 1986 | | |
1992 | | - | |
1993 | | - | |
1994 | | - | |
1995 | | - | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
1996 | 1995 | | |
1997 | | - | |
1998 | | - | |
| 1996 | + | |
| 1997 | + | |
1999 | 1998 | | |
2000 | 1999 | | |
2001 | 2000 | | |
| |||
2050 | 2049 | | |
2051 | 2050 | | |
2052 | 2051 | | |
| 2052 | + | |
2053 | 2053 | | |
2054 | 2054 | | |
2055 | 2055 | | |
| |||
2381 | 2381 | | |
2382 | 2382 | | |
2383 | 2383 | | |
2384 | | - | |
2385 | | - | |
2386 | | - | |
2387 | | - | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
2388 | 2390 | | |
2389 | 2391 | | |
2390 | 2392 | | |
| |||
2396 | 2398 | | |
2397 | 2399 | | |
2398 | 2400 | | |
2399 | | - | |
| 2401 | + | |
2400 | 2402 | | |
2401 | 2403 | | |
2402 | 2404 | | |
2403 | | - | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
2404 | 2409 | | |
2405 | 2410 | | |
2406 | 2411 | | |
| |||
0 commit comments