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

TypeError: Assignment to constant variable. #16211

Closed
lidaof opened this issue Jul 25, 2019 · 14 comments
Closed

TypeError: Assignment to constant variable. #16211

lidaof opened this issue Jul 25, 2019 · 14 comments

Comments

@lidaof
Copy link

lidaof commented Jul 25, 2019

Do you want to request a feature or report a bug?
bug
What is the current behavior?

TypeError: Assignment to constant variable.

image

System: OSX
npm: 6.10.2
node: v10.13.0
react: 16.8.6

@artuross
Copy link

artuross commented Jul 26, 2019

What I think you're trying to is something like this:

const something = 1;
something = 2;

Even though the path implies that the error happens in react, I think the error happens in your code, but it's difficult to tell from a single line. Perhaps you could share a little bit more (error stack)?

@lidaof
Copy link
Author

lidaof commented Jul 26, 2019

Hi @artuross , thank you so much for reply. Sure, here is the screenshot:
image

I don't think I did that const thing....my code is here

@jquense
Copy link
Contributor

jquense commented Jul 26, 2019

@lidaof the error is coming from your code so there is either a typo/bug in what you've written or a problem compiling it. In either case it's not realted to React, and the React issue tracker is for React bugs. I'd recommend bisecting your code, commenting out bits and pieces until the error goes away and you can narrow down which part specifically is breaking it.

@jquense jquense closed this as completed Jul 26, 2019
@lidaof
Copy link
Author

lidaof commented Jul 26, 2019

Hi @jquense ok....so the problem only happens on build version, it's not happening in development version.......so the code should be fine....

@artuross
Copy link

@lidaof I would look at lines 112 and 126 at ArcDisplay.tsx.

@shahchaitanya
Copy link

I am facing a similar issue today. @lidaof did you find out a solution to fix it?

@lidaof
Copy link
Author

lidaof commented Jul 29, 2019

I am not sure if we have same condition, I updated typescript to 3.4 and create-react-app to 2.1 solved this problem. @shahchaitanya

@shahchaitanya
Copy link

@lidaof are you using uglify js plugin in Production? This problem is occurred due to this plugin. These links are referred to this bug. I solved this issue by adding inline:false in uglify js compress object.

@lidaof
Copy link
Author

lidaof commented Jul 30, 2019

Thank you for reply @shahchaitanya . I think i did use it, but I don't know where to put this option. I was using react-app-rewire with react-scripts-ts

@shahchaitanya
Copy link

@lidaof you can configure your web pack in webpack.config.js file. I put this option under webpack.config.js.

@lidaof
Copy link
Author

lidaof commented Jul 30, 2019

thank you @shahchaitanya . I tried that but it's not working for me. Thanks again.

@prasenpatil2107
Copy link

I think there is a simple catch.....if you define it as const you cant change its value. To resolve it just define it by let and try. I was going through a similar error solved it by this.

@jannunen
Copy link

You just saved my day (after 10 hours of fiddling).

@ghost
Copy link

ghost commented Oct 25, 2021

Knock Knock, I am also facing the same problem. 😄

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

6 participants