Description
Describe the bug
Overview
Previously there was some discussion over the use of yarn PNP / berry here
The main advantage of PNP is that it allows you to reference packages from a global cache on the disk (similar to pnpm except without the disk hard links). So it saves on disk space with the global cache setting enabled.
With yarn 3.2.1 PNP this sort of half works.
If you install and set everything up then it works fine on the first run, but then fails on the follow up run due to something related to the .svelte-kit caching
Reproduction
Example
First setup a new svelte kit app (skeleton)
yarn create svelte myapp
cd myapp
Switch to yarn berry with PNP
yarn set version berry
Add the following to the config under the kit section of svelte.config.js
kit: {
vite: {server: {fs: {allow: ['.yarn']}}},
}
Try yarn dev
yarn dev
At this point things work on the first run
On follow up runs this error shows up
> p.replace is not a function
at Object.toPortablePath (C:\SourceCode\project-docs\example\.pnp.cjs:2808:9)
at PosixFS.mapToBase (C:\SourceCode\project-docs\example\.pnp.cjs:5313:18)
at PosixFS.rmdirSync (C:\SourceCode\project-docs\example\.pnp.cjs:5230:39)
at URLFS.rmdirSync (C:\SourceCode\project-docs\example\.pnp.cjs:5230:24)
at _rmdirSync (node:internal/fs/rimraf:260:21)
at rimrafSync (node:internal/fs/rimraf:193:7)
at node:internal/fs/rimraf:253:9
at Array.forEach (<anonymous>)
at _rmdirSync (node:internal/fs/rimraf:250:7)
at rimrafSync (node:internal/fs/rimraf:193:7)
If I delete the .svelte-kit
directory then it works fine again for a first run.
Logs
No response
System Info
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 5.34 GB / 15.68 GB
Binaries:
Node: 18.1.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.2.1 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.44)
Internet Explorer: 11.0.19041.1566
Severity
annoyance
Additional Information
No response