Skip to content

Added info for using yarn berry with yarn 3.2.1 #5169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions documentation/faq/80-integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,29 @@ onMount(() => {
### Does it work with Yarn 2?

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.

### Yarn 3 Berry Example

Currently ESM Support within the latest yarn (version 3) is considered experimental.
The below seems to work although you're results may vary.

First create a new application
```sh
yarn create svelte myapp
cd myapp
```

To enable yarn berry
```sh
yarn set version berry
yarn install
```

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. If you have **enableGlobalCache** set to true then you may need to add this to the `svelte.config.js`

```json
kit: {
vite: {server: {fs: {allow: ['.yarn']}}},
...
}
```