Skip to content

[Feature]: Support latest stable version of Yarn by default #1246

Open
@o-l-a-v

Description

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:

  • 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 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 [email protected]+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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions