gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)

Home Page:http://gaearon.github.io/react-hot-loader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yarn 3 PNP not compatible

dylanplural opened this issue · comments

If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.

Description

With yarn2+ (pnp enabled) is used for module resolution. hmr does not work as expected. The documented command
yarn add react-dom@npm:@hot-loader/react-dom
resolves in an error:

yarn add react-dom@npm:@hot-loader/react-dom
➤ YN0001: │ Error: react-dom@npm:@hot-loader/react-dom isn't supported by any available resolver

And the alternative (webpack aliases) results in a runtime error:

Compiled with problems:X

ERROR in ../../.yarn/__virtual__/@szhsin-react-menu-virtual-9328d7bf3c/0/cache/@szhsin-react-menu-npm-3.0.0-c9f0bfbaf8-cfa13060d2.zip/node_modules/@szhsin/react-menu/dist/es/components/ControlledMenu.js 3:0-41

Module not found: Error: Can't resolve 'react-dom' in ...

ERROR in ../../.yarn/__virtual__/@szhsin-react-menu-virtual-9328d7bf3c/0/cache/@szhsin-react-menu-npm-3.0.0-c9f0bfbaf8-cfa13060d2.zip/node_modules/@szhsin/react-menu/dist/es/components/SubMenu.js 3:0-41

Module not found: Error: Can't resolve 'react-dom' in ...

Environment

React Hot Loader version: 17.0.2

Run these commands in the project folder and fill in their results:

  1. node -v: 16.14.2
  2. npm -v: 8.5.0
  3. yarn -v: 3.2.0

Then, specify:

  1. Operating system: Windows 10
  2. Browser and version: chrome latest