Open esetnik opened 5 years ago
Lets first figure out why yarn
is doing it.
That's yarn feature is very quirky, but it works. you my lock it better using yarn resolutions I believe it will get better in yarn 2
I hope sooner or later required hooks would naturally move to the real react-dom.
Hello, Is there any update on this?
I came across this issue while trying to use @hot-loader/react-dom
with Yarn 2 but it breaks complaining with messages like this:
ERROR in ~/.yarn/$$virtual/react-modal-virtual-786af9ff96/0/cache/react-modal-npm-3.6.1-131512d49b-2.zip/node_modules/react-modal/lib/components/Modal.js
Module not found: Error: react-modal tried to access @hot-loader/react-dom, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: @hot-loader/react-dom (via "@hot-loader/react-dom")
Required by: react-modal@virtual:8c9912264b14a583bf71e56248162a803918c4e372c01213a23039a7b527f13db3fcc7e9ceee9f7e7ce6c84d55b3367b1164a40f0c8dd192b60b29392931909d#npm:3.6.1 (via ~/.yarn/$$virtual/react-modal-virtual-786af9ff96/0/cache/react-modal-npm-3.6.1-131512d49b-2.zip/node_modules/react-modal/lib/components/Modal.js)
The way we use @hot-loader/react-dom
is by aliasing it as react-dom
in webpack config
The way we use @hot-loader/react-dom is by aliasing it as react-dom in webpack config
I don't have any solution for this case.
Technically #22 should be a good fix this, however we all are (at least I am) waiting for the react-fresh
, which would not require all of this.
However, I am wondering how preact
is solving this - it's again about aliasing react
to other package.
See https://github.com/yarnpkg/yarn/issues/7062. Maybe we should add a note to the readme indicating that the user shouldn't run
yarn upgrade
when using @hot-loader/react-dom with yarn's name resolution.