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

Usage with Create React App #37

Closed
fracek opened this issue Oct 31, 2021 · 7 comments
Closed

Usage with Create React App #37

fracek opened this issue Oct 31, 2021 · 7 comments
Labels
Type: bug Something isn't working

Comments

@fracek
Copy link
Contributor

fracek commented Oct 31, 2021

I made an example using this library with react, everything is working fine in development, but in production it looks like starknet.js is throwing a type error. You can open this page to see the error more in detail.

To reproduce locally:

  • Clone my example repo
  • Build with yarn run build
  • Serve production build with yarn run serve
@janek26
Copy link
Member

janek26 commented Oct 31, 2021

Hey,

please have a look here:
paulmillr/noble-ed25519#23

it seems like the issue is in react scripts code, could you try to locate that bug in their source code?

Have you tried with next's/parcel? :) So we'd know if it's a general thing

@janek26 janek26 added Type: bug Something isn't working help wanted Extra attention is needed labels Oct 31, 2021
@janek26
Copy link
Member

janek26 commented Oct 31, 2021

This helps:

"browserslist": {
    "production": [
      "chrome >= 67",
      "edge >= 79",
      "firefox >= 68",
      "opera >= 54",
      "safari >= 14"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }

in package.json

The issue is that native BigInt support is required atm

@janek26 janek26 changed the title TypeError in production build Usage with Create React App Oct 31, 2021
@janek26 janek26 pinned this issue Oct 31, 2021
@fracek
Copy link
Contributor Author

fracek commented Nov 1, 2021

This worked like a charm (had to delete node_modules). Closing, thank you again.

@fracek fracek closed this as completed Nov 1, 2021
@janek26 janek26 removed the help wanted Extra attention is needed label Nov 1, 2021
@0xs34n 0xs34n unpinned this issue Nov 9, 2021
@janek26 janek26 pinned this issue Nov 12, 2021
@MorganIsBatman
Copy link

"browserslist": {
    "production": [
      "chrome >= 67",
      "edge >= 79",
      "firefox >= 68",
      "opera >= 54",
      "safari >= 14"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }

You are a legend @janek! I was about to gear myself up to faff about with my tsconfig when I found this. Instant solve! Thank you sir

@maht0rz
Copy link

maht0rz commented Dec 28, 2021

@janek26 your fix just saved my day, i wonder what is the actual root cause of this problem - but thanks!

@janek26
Copy link
Member

janek26 commented Dec 28, 2021

The issue is that native BigInt support is required atm

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#browser_compatibility

Hopefully this will be fixed soon by StarkWare switching BigInts to hex strings in compiled contracts

@starknet-io starknet-io locked as resolved and limited conversation to collaborators Dec 28, 2021
@0xs34n
Copy link
Collaborator

0xs34n commented Apr 25, 2022

Users who build on the web should probably use next.js as there is an issue with the following packages:

#172

#131

logesh2496 pushed a commit to nusic-fm/music-assets-uploader that referenced this issue May 24, 2022
@penovicp penovicp unpinned this issue Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants