reach-sh / reach-lang

Reach: The Safest and Smartest DApp Programming Language

Home Page:https://www.reach.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reach 0.1.11-rc.6 has a dependency of React 18+

kieranroneill opened this issue · comments

Describe the error

With the introduction of PeraWallet Connect support, there is now a dependency for React 18+ due to PeraWallet Connect having a peer dependency for react and react-dom 18+ packages (https://github.com/perawallet/connect/blob/94765603c293aafa002ce262a0bed388d39fc49e/package.json#L42).

To Reproduce

  • Build a non-React application and ensure react/react-dom is not a dependency
  • The following error is displayed:
Cannot find module 'react' from '../../node_modules/@perawallet/connect/dist/index.js'

    Require stack:
      /path/to/app/node_modules/@perawallet/connect/dist/index.js
      node_modules/@reach-sh/stdlib/dist/cjs/ALGO_PeraConnect.js
      node_modules/@reach-sh/stdlib/dist/cjs/index.js

Expected behavior

  • The dApp, whether server or client, would not require react/react-dom as a dependency.

Extra information

git hash: 6e49541
package version: v0.1.11-rc.6

Thanks, Kieran. @DanBurton, can you put this on our schedule and think about the best way to do it? Maybe we have @reach-sh/stdlib-react or figure out a way to change the code so it takes @perawallet/connect as a dynamic argument?

Acknowledged.

Is there any way to bypass this problem? I get the same error when I install older versions.

anyway to handle this temporarily please?

@nftcrps @alcyoneus-g does npm install react react-dom work as a workaround?

do you still need to test this? I'm very hesitant to add react and react-dom as dependencies on a Vue2 project. Wouldn't Webpack add them to the vendors file?

A fix for this was just merged... #1423