Skip to content
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

@rspack/plugin-react-refresh tried to access react-refresh #4284

Closed
HrvojeFER opened this issue Oct 6, 2023 · 3 comments
Closed

@rspack/plugin-react-refresh tried to access react-refresh #4284

HrvojeFER opened this issue Oct 6, 2023 · 3 comments
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@HrvojeFER
Copy link

System Info

System:
OS: Windows 10 10.0.22621
CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
Memory: 5.66 GB / 15.95 GB
Binaries:
Node: 20.4.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.6.1 - C:\Program Files\nodejs\yarn.CMD
npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.2283.0), Chromium (117.0.2045.47)
Internet Explorer: 11.0.22621.1

Details

Running yarn rspack --mode production build gave me:

Error: @rspack/plugin-react-refresh tried to access react-refresh (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

I solved the problem adding the following to yarnrc.yml:

packageExtensions:
  "@rspack/[email protected]":
    dependencies:
      react-refresh: ">=0.10.0 <1.0.0"

Please consider making react-refresh a dependency of @rspack/plugin-react-refresh and not a peer dependency.

Reproduce link

No response

Reproduce Steps

  1. init repo with yarn pnp
  2. yarn install @rspack/cli
  3. create simple rspack.config.js
  4. yarn rspack --mode production build
@HrvojeFER HrvojeFER added bug Something isn't working pending triage The issue/PR is currently untouched. labels Oct 6, 2023
@HrvojeJuric
Copy link

I'm @HrvojeFER.

Just realized Yarn PnP is not supported #2236 and I was using Yarn PnP, but i decided to switch to Yarn pnpm because rspack is so darn fast compared to webpack.

Regarding this issue, @rspack/plugin-react-refresh tries to access react-refresh and fails even with Yarn pnpm.

@hardfist
Copy link
Contributor

hardfist commented Oct 6, 2023

should be resolved when #4267 lands, maybe you can workaround it by alias now

@HrvojeJuric
Copy link

Ok, tyvm!

The .yarnrc.yml bit works for me for now.

@hardfist hardfist closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

3 participants