But Yarn v4.3.1 uses Yarn PnP https://yarnpkg.com/features/pnp for node packages installation strategy by default, which Rspack does not seem to support.
Feature request:
Short term, until Rspack supports Yarn PnP: Detect if project was initialized with yarn create rspress and create .yarnrc.yml with content nodeLinker: node-modules. This will tell Yarn to use the node default node-modules directory for installing node packages. Then yarn run dev works.
Long term: Support Yarn PnP.
Repro short recipe, using Yarn v4.3.1, everything default
yarn create rspress@latest
cd .\rspress-site\
yarn install
yarn run dev
With output on my system
```powershell
PowerShell Core v7.4.3 x64
PS C:\Users\olav.birkeland\Desktop\tes> yarn create rspress@latest
β€ YN0000: Β· Yarn 4.3.1
β€ YN0000: β Resolution step
β€ YN0085: β + create-rspress@npm:1.26.0
β€ YN0000: β Completed
β€ YN0000: β Fetch step
β€ YN0013: β A package was added to the project (+ 383.84 KiB).
β€ YN0000: β Completed
β€ YN0000: β Link step
β€ YN0000: β Completed
β€ YN0000: Β· Done in 0s 213ms
β Project folder ... rspress-site
β Site Title ... Rspress
β Site Description ... Rspack-based Static Site Generator
Done. Now run:
cd rspress-site
yarn install
yarn run dev
PS C:\Users\olav.birkeland\Desktop\tes> cd .\rspress-site\
PS C:\Users\olav.birkeland\Desktop\tes\rspress-site> yarn install
! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing yarn@4.3.1+sha512.af78262d7d125afbfeed740602ace8c5e4405cd7f4735c08feb327286b2fdb2390fbca01589bfd1f50b1240548b74806767f5a063c94b67e431aabd0d86f7774.
! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager
β€ YN0000: Β· Yarn 4.3.1
β€ YN0000: β Resolution step
β€ YN0085: β + @types/node@npm:16.18.101, rspress@npm:1.26.0, @babel/runtime@npm:7.24.7, and 479 more.
β€ YN0000: β Completed in 1s 943ms
β€ YN0000: β Post-resolution validation
β€ YN0086: β Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
β€ YN0000: β Completed
β€ YN0000: β Fetch step
β€ YN0013: β A package was added to the project (+ 294.16 KiB).
β€ YN0000: β Completed in 0s 215ms
β€ YN0000: β Link step
β€ YN0000: β ESM support for PnP uses the experimental loader API and is therefore experimental
β€ YN0007: β core-js@npm:3.37.1 must be built because it never has been before or the last one failed
β€ YN0000: β Completed in 6s 528ms
β€ YN0000: Β· Done with warnings in 8s 770ms
PS C:\Users\olav.birkeland\Desktop\tes\rspress-site> yarn run dev
π₯ Rspress v1.26.0
> Network: http://192.168.86.105:3000/
> Network: http://localhost:3000/
> Network: http://172.30.96.1:3000/
start Compiling...
error Compile error:
Failed to compile, check the errors for troubleshooting.
Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rsbuild-core-npm-1.0.0-alpha.6-c59c27cadc-10c0.zip\node_modules\@rsbuild\core\dist\client\overlay.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site'
Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspress-core-npm-1.26.0-ffa0db03a2-10c0.zip\node_modules\@rspress\core\dist\runtime\clientEntry.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site'
Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-plugin-react-refresh-virtual-e774b93185\4\AppData\Local\Yarn\Berry\cache\@rspack-plugin-react-refresh-npm-1.0.0-alpha.2-951b047d7e-10c0.zip\node_modules\@rspack\plugin-react-refresh\client\reactRefreshEntry.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site'
Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rsbuild-core-npm-1.0.0-alpha.6-c59c27cadc-10c0.zip\node_modules\@rsbuild\core\dist\client\hmr.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site'
Γ Error: [html-rspack-plugin]: Child compilation failed:
β Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspress-core-npm-1.26.0-ffa0db03a2-10c0.zip\node_modules\@rspress\core\index.html' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site'
β
β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\html-rspack-plugin-virtual-ad2ec0b608\4\AppData\Local\Yarn\Berry\cache\html-rspack-plugin-npm-6.0.0-beta.3-e2e78ff833-10c0.zip\node_modules\html-rspack-plugin\lib\child-compiler.js:174:18
β at finalCallback (C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:348:17)
β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:375:20
β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:471:28
β at done (C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspack-lite-tapable-npm-1.0.0-alpha.2-cf220543eb-10c0.zip\node_modules\@rspack\lite-tapable\dist\index.js:478:13)
β at AsyncSeriesHook.callAsyncStageRange (C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspack-lite-tapable-npm-1.0.0-alpha.2-cf220543eb-10c0.zip\node_modules\@rspack\lite-tapable\dist\index.js:485:20)
β at AsyncSeriesHook.callAsync (C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspack-lite-tapable-npm-1.0.0-alpha.2-cf220543eb-10c0.zip\node_modules\@rspack\lite-tapable\dist\index.js:88:21)
β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:467:41
β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:534:23
PS C:\Users\olav.birkeland\Desktop\tes\rspress-site>
```
What problem does this feature solve?
As of writing, the latest version of Yarn is v4.3.1.
Your quickstart says using Yarn is an option:
But Yarn v4.3.1 uses Yarn PnP https://yarnpkg.com/features/pnp for node packages installation strategy by default, which Rspack does not seem to support.
Feature request:
yarn create rspress
and create.yarnrc.yml
with contentnodeLinker: node-modules
. This will tell Yarn to use the node defaultnode-modules
directory for installing node packages. Thenyarn run dev
works.Repro short recipe, using Yarn v4.3.1, everything default
With output on my system
```powershell PowerShell Core v7.4.3 x64 PS C:\Users\olav.birkeland\Desktop\tes> yarn create rspress@latest β€ YN0000: Β· Yarn 4.3.1 β€ YN0000: β Resolution step β€ YN0085: β + create-rspress@npm:1.26.0 β€ YN0000: β Completed β€ YN0000: β Fetch step β€ YN0013: β A package was added to the project (+ 383.84 KiB). β€ YN0000: β Completed β€ YN0000: β Link step β€ YN0000: β Completed β€ YN0000: Β· Done in 0s 213ms β Project folder ... rspress-site β Site Title ... Rspress β Site Description ... Rspack-based Static Site Generator Done. Now run: cd rspress-site yarn install yarn run dev PS C:\Users\olav.birkeland\Desktop\tes> cd .\rspress-site\ PS C:\Users\olav.birkeland\Desktop\tes\rspress-site> yarn install ! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing yarn@4.3.1+sha512.af78262d7d125afbfeed740602ace8c5e4405cd7f4735c08feb327286b2fdb2390fbca01589bfd1f50b1240548b74806767f5a063c94b67e431aabd0d86f7774. ! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager β€ YN0000: Β· Yarn 4.3.1 β€ YN0000: β Resolution step β€ YN0085: β + @types/node@npm:16.18.101, rspress@npm:1.26.0, @babel/runtime@npm:7.24.7, and 479 more. β€ YN0000: β Completed in 1s 943ms β€ YN0000: β Post-resolution validation β€ YN0086: β Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details. β€ YN0000: β Completed β€ YN0000: β Fetch step β€ YN0013: β A package was added to the project (+ 294.16 KiB). β€ YN0000: β Completed in 0s 215ms β€ YN0000: β Link step β€ YN0000: β ESM support for PnP uses the experimental loader API and is therefore experimental β€ YN0007: β core-js@npm:3.37.1 must be built because it never has been before or the last one failed β€ YN0000: β Completed in 6s 528ms β€ YN0000: Β· Done with warnings in 8s 770ms PS C:\Users\olav.birkeland\Desktop\tes\rspress-site> yarn run dev π₯ Rspress v1.26.0 > Network: http://192.168.86.105:3000/ > Network: http://localhost:3000/ > Network: http://172.30.96.1:3000/ start Compiling... error Compile error: Failed to compile, check the errors for troubleshooting. Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rsbuild-core-npm-1.0.0-alpha.6-c59c27cadc-10c0.zip\node_modules\@rsbuild\core\dist\client\overlay.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site' Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspress-core-npm-1.26.0-ffa0db03a2-10c0.zip\node_modules\@rspress\core\dist\runtime\clientEntry.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site' Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-plugin-react-refresh-virtual-e774b93185\4\AppData\Local\Yarn\Berry\cache\@rspack-plugin-react-refresh-npm-1.0.0-alpha.2-951b047d7e-10c0.zip\node_modules\@rspack\plugin-react-refresh\client\reactRefreshEntry.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site' Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rsbuild-core-npm-1.0.0-alpha.6-c59c27cadc-10c0.zip\node_modules\@rsbuild\core\dist\client\hmr.js' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site' Γ Error: [html-rspack-plugin]: Child compilation failed: β Γ Resolve error: Can't resolve 'C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspress-core-npm-1.26.0-ffa0db03a2-10c0.zip\node_modules\@rspress\core\index.html' in 'C:\Users\olav.birkeland\Desktop\tes\rspress-site' β β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\html-rspack-plugin-virtual-ad2ec0b608\4\AppData\Local\Yarn\Berry\cache\html-rspack-plugin-npm-6.0.0-beta.3-e2e78ff833-10c0.zip\node_modules\html-rspack-plugin\lib\child-compiler.js:174:18 β at finalCallback (C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:348:17) β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:375:20 β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:471:28 β at done (C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspack-lite-tapable-npm-1.0.0-alpha.2-cf220543eb-10c0.zip\node_modules\@rspack\lite-tapable\dist\index.js:478:13) β at AsyncSeriesHook.callAsyncStageRange (C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspack-lite-tapable-npm-1.0.0-alpha.2-cf220543eb-10c0.zip\node_modules\@rspack\lite-tapable\dist\index.js:485:20) β at AsyncSeriesHook.callAsync (C:\Users\olav.birkeland\AppData\Local\Yarn\Berry\cache\@rspack-lite-tapable-npm-1.0.0-alpha.2-cf220543eb-10c0.zip\node_modules\@rspack\lite-tapable\dist\index.js:88:21) β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:467:41 β at C:\Users\olav.birkeland\Desktop\tes\rspress-site\.yarn\__virtual__\@rspack-core-virtual-b1014f7446\4\AppData\Local\Yarn\Berry\cache\@rspack-core-npm-1.0.0-alpha.2-a7f9e1c38a-10c0.zip\node_modules\@rspack\core\dist\Compiler.js:534:23 PS C:\Users\olav.birkeland\Desktop\tes\rspress-site> ```What does the proposed API look like?
I have no idea.