react-grid-layout / react-resizable

A simple React component that is resizable with a handle.

Home Page:https://strml.github.io/react-resizable/examples/1.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yarn PnP webpack `react-dom` dependency issue

peterhirn opened this issue · comments

Thanks for opening an issue!

Please select the type of issue you're reporting. For questions.

  • Bug
  • Feature Request
  • Question

Problem Report

Dependency on react-dom broken. Probably related to react-grid-layout/react-draggable#525

yarn install

react-resizable@npm:3.0.4 [65850] doesn't provide react-dom (p951c8), requested by react-draggable

webpack

ERROR in ../../.yarn/__virtual__/react-draggable-virtual-79cbb65d2e/0/cache/react-draggable-npm-4.4.4-f0b7a5c546-b8258a5893.zip/node_modules/react-draggable/build/cjs/DraggableCore.js 14:39-59        
Module not found: Error: react-draggable tried to access react-dom (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Workaround

Add to .yarnrc.yml

packageExtensions:
  react-resizable@*:
    peerDependencies:
      react-dom: "*"

Then run yarn install.

Same problem here. The workaround did not work for me. Just to be clear, my problem was react-draggable and not react-resizable! Further more, it seems like peerDependencies are not supported with @yarn v3.2.0.

My fix for the

Module not found: Error: react-draggable tried to access react-dom (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

error is:

packageExtensions:
  "react-draggable@*":
      dependencies:
        "react-dom": "*"

in the yarnrc.yml.

I hope this "hacks" don't become standard when working with Yarn > 1...