0

In the build version of my reactjs application, I get the error of

react_devtools_backend.js:2560 TypeError: Assignment to constant variable.
    at y._init (17.19deb280.chunk.js:1)
    at new y (17.19deb280.chunk.js:1)
    at Function.from (17.19deb280.chunk.js:1)
    at points (17.19deb280.chunk.js:1)
    at 17.19deb280.chunk.js:1
    at Object.useMemo (main.19deb280.js:1)
    at t.useMemo (main.19deb280.js:1)
    at R (17.19deb280.chunk.js:1)
    at U (17.19deb280.chunk.js:1)
    at Ko (main.19deb280.js:1)

However, everything works fine in the development mode and I get no error. This problem only happens in the production mode and I cannot figure out what is causing this issue. I appreciate any help.

Saba
  • 376
  • 5
  • 19
  • very hard to know without looking at the actual code, but stack trace mentions the `useMemo` hook, are you using it in any part of your code? – diedu Jun 08 '21 at 03:39
  • I don't see this error in the development environment so that I cannot event know which part of the whole project is causing this problem in the production version. And about useMemo, I don't use it in any part of my code, but maybe some libraries that I have in my code, use it in their background calcualtions. Anyway, I cannot really figure out what is happening since I don't see it in development :( – Saba Jun 08 '21 at 05:40
  • are you using CRA for building your project? what libraries are you using? does your app work in an incognito window? – diedu Jun 08 '21 at 06:28
  • thanks for your reply. No, I am not using cra. I think the problem is caused by the https://github.com/plouc/nivo package which I am using in most parts. No, the same error happens in an incognito window. – Saba Jun 08 '21 at 06:52
  • could you try disabling strict mode in your build https://stackoverflow.com/a/35173954/1868008, you could also do it manually I think, searching for "use strict" in your main.19deb280.js file and removing it, probably this would avoid crashing the app and let you see what UI part is the `Ko` component by searching for it in the react dev tools – diedu Jun 08 '21 at 14:07
  • Thank you for your reply. I did as you suggested but the same error happened again :'( – Saba Jun 09 '21 at 06:33

1 Answers1

0

check this issue on React repo - https://github.com/facebook/react/issues/16211#issuecomment-516180557

kkchaitu
  • 631
  • 2
  • 5
  • 24