Skip to content

Yarn 3 PNP not compatible #1809

@dylanplural

Description

@dylanplural

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions