Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Closing soon] Webpack Issues #20

Closed
anthonyra opened this issue Feb 7, 2023 · 10 comments
Closed

[Closing soon] Webpack Issues #20

anthonyra opened this issue Feb 7, 2023 · 10 comments

Comments

@anthonyra
Copy link

anthonyra commented Feb 7, 2023

**Before reporting, I have already ***

Describe the bug

Using create-react-app and building with the js-sdk I'm running into some errors.

  1. Needing to add fallbacks for crypto and stream with crypto-browserify and stream-browserify
  2. Seeing a "Critical dependency: the request of a dependency is an expression" with the ecsda-sdk
To ignore, add // eslint-disable-next-line to the line before.

WARNING in ./node_modules/@lit-protocol/encryption/node_modules/@lit-protocol/crypto/node_modules/@lit-protocol/ecdsa-sdk/src/lib/ecdsa-sdk.js 312:16-55
Critical dependency: the request of a dependency is an expression

To Reproduce
Steps to reproduce the behavior:

  1. Create new React app with npx create-react-app my-app
  2. Update npm start to "GENERATE_SOURCEMAP=false react-scripts start" in package.json
  3. Add the following to node_modules/react-scripts/configs/webpack.config.js line 305
    resolve: {
      // This allows you to set a fallback for where webpack should look for modules.
      // We placed these paths second because we want `node_modules` to "win"
      // if there are any conflicts. This matches Node resolution mechanism.
      // https://github.com/facebook/create-react-app/issues/253
      modules: ['node_modules', paths.appNodeModules].concat(
        modules.additionalModulePaths || []
      ),
      fallback: {
        "crypto": require.resolve("crypto-browserify"),
        "stream": require.resolve("stream-browserify")
      },
  1. Run npm install crypto-browserify stream-browserify
  2. See
WARNING in ./node_modules/@lit-protocol/encryption/node_modules/@lit-protocol/crypto/node_modules/@lit-protocol/ecdsa-sdk/src/lib/ecdsa-sdk.js 312:16-55
Critical dependency: the request of a dependency is an expression

Expected behavior
Hopefully no warnings 😅

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  "dependencies": {
    "@lit-protocol/lit-node-client": "^2.1.25",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "crypto-browserify": "^3.12.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "stream-browserify": "^3.0.0",
    "web-vitals": "^2.1.4"
},

Additional info
Add any other context about the problem here.

@joshLong145
Copy link

Can also confirm that these errors occur when bundling.

@AireshBhat
Copy link

@anthonyra Were you able to fix this issue?

@Ansonhkg Ansonhkg mentioned this issue Mar 9, 2023
@Ansonhkg
Copy link
Collaborator

Ansonhkg commented Mar 9, 2023

Hey @anthonyra can you try if this version works for you?

yarn add @lit-protocol/lit-node-client@2.1.55

Also with this update you don't need to do npm install crypto-browserify stream-browserify anymore, but GENERATE_SOURCEMAP=false react-scripts start still needed

@mattcasey
Copy link

mattcasey commented Mar 29, 2023

I am seeing this issue, I was just trying to migrate from v1 to v2 in a next.js app, using v2.1.96:

warn  - ./node_modules/@lit-protocol/ecdsa-sdk/src/lib/ecdsa-sdk.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/@lit-protocol/ecdsa-sdk/src/lib/ecdsa-sdk.js
./node_modules/@lit-protocol/ecdsa-sdk/src/index.js
./node_modules/@lit-protocol/crypto/src/lib/crypto.js
./node_modules/@lit-protocol/crypto/src/index.js
./node_modules/@lit-protocol/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.js
./node_modules/@lit-protocol/lit-node-client-nodejs/src/index.js
./node_modules/@lit-protocol/lit-node-client/src/index.js
./adapters/litProtocol/hooks/useLitProtocol.tsx

@math77
Copy link

math77 commented Apr 18, 2023

I am seeing the same issue @mattcasey in my nextjs app with lit-node-client version 2.1.123

I tried to downgrade to version 2.1.55, but then I got a missing web3modal standalone error

Any tips on how I can solve it?

@mattcasey
Copy link

mattcasey commented Apr 25, 2023

@math77 we are just sticking with the original SDK, "lit-js-sdk" until this is resolved, so I don't have any suggestions, sorry.

@DorianWilhelm
Copy link

We are also running into the same issue when trying to upgrade. Downgrading isn't a solution as it's requesting the missing @web3modal/standalone, which then gives us a missing "react-native" dependency.
Any other workarounds available for now?

@Ansonhkg Ansonhkg mentioned this issue May 4, 2023
@Ansonhkg
Copy link
Collaborator

Ansonhkg commented May 4, 2023

@DorianWilhelm @mattcasey @math77

Apologies for the delay. I've tested the latest version and it appears to be working. Could you both please try version 2.1.156 and let me know how it works for you?

@math77
Copy link

math77 commented May 4, 2023

@Ansonhkg it seems to be working now, at least I didn't get errors when running the app as I got before. I will do a complete test trying to use the sdk

@Ansonhkg Ansonhkg changed the title Webpack Issues [In Review] Webpack Issues May 4, 2023
@DorianWilhelm
Copy link

@Ansonhkg updating to 2.1.158 works for me 👍

@Ansonhkg Ansonhkg changed the title [In Review] Webpack Issues [Closing soon] Webpack Issues May 8, 2023
@Ansonhkg Ansonhkg closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants