Skip to content

Commit 41baa6f

Browse files
authoredJun 22, 2022
Added info for using yarn berry with yarn 3.2.1 (#5169)
* Added info for using yarn berry * docs update * docs update * docs update * updates * docs update * doc updates
1 parent d745435 commit 41baa6f

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed
 

‎documentation/faq/80-integrations.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,34 @@ onMount(() => {
103103
});
104104
```
105105

106-
### Does it work with Yarn 2?
106+
### How do I use with Yarn?
107+
108+
#### Does it work with Yarn 2?
107109

108110
Sort of. The Plug'n'Play feature, aka 'pnp', is broken (it deviates from the Node module resolution algorithm, and [doesn't yet work with native JavaScript modules](https://github.com/yarnpkg/berry/issues/638) which SvelteKit — along with an [increasing number of packages](https://blog.sindresorhus.com/get-ready-for-esm-aa53530b3f77) — uses). You can use `nodeLinker: 'node-modules'` in your [`.yarnrc.yml`](https://yarnpkg.com/configuration/yarnrc#nodeLinker) file to disable pnp, but it's probably easier to just use npm or [pnpm](https://pnpm.io/), which is similarly fast and efficient but without the compatibility headaches.
111+
112+
#### How do I use with Yarn 3?
113+
114+
Currently ESM Support within the latest Yarn (version 3) is considered [experimental](https://github.com/yarnpkg/berry/pull/2161).
115+
116+
The below seems to work although your results may vary.
117+
118+
First create a new application:
119+
```sh
120+
yarn create svelte myapp
121+
cd myapp
122+
```
123+
124+
And enable Yarn Berry:
125+
```sh
126+
yarn set version berry
127+
yarn install
128+
```
129+
130+
**Yarn 3 global cache**
131+
132+
One of the more interesting features of Yarn Berry is the ability to have a single global cache for packages, instead of having multiple copies for each project on the disk. However, setting `enableGlobalCache` to true causes building to fail, so it is recommended to add the following to the `.yarnrc.yml` file:
133+
```
134+
nodeLinker: node-modules
135+
```
136+
This will cause packages to be downloaded into a local node_modules directory but avoids the above problem and is your best bet for using version 3 of Yarn at this point in time.

0 commit comments

Comments
 (0)
Please sign in to comment.