I have React app install a third-party package using Typsecript, running my react app current get an error message like below:
Class constructor Name cannot be invoked without 'new'
I did try to decare a variable with new for that, does not work.
so I dig deeper turn out the third package we use to extend of component have this setting in the tsconfig.json
{
"compilerOptions": {
"target": "es5",
}
}
Is any way I can overwrite this setting in my current react app since I don't can't change that package?
Thanks!
I do not believe that this is possible, since if you did not create the app with the typescript template react-scripts will not use typescript. You have two options here: use cra to make a new app using the --template typescript option and copy your code, or run npm run eject or yarn eject to expose the configuration files for webpack and add the loader yourself, although this is risky because it risks messing up the project configurations.