'"react-scripts build" is updating my "jsx":"react" to "jsx":"react-jsx" in tsconfig.json file

When I run

react-scripts build

I get the following message :

The following changes are being made to your tsconfig.json file:
  - compilerOptions.jsx must be react-jsx (to support the new JSX transform in React 17)

However I do not have React 17. It is not installed, or in my package.json file.

The only thing I did was upgrade to React 17 a few days ago to play around with it, but then I reverted. Everything is back to 16.

Why does react-scripts think it should update my JSX?



Solution 1:[1]

I just realised what the problem was.

I had a package.json file one level up from my actual project. It was there by accident. Inside the "parent" package.json I had React 17 defined.

package.json
|
|----- package.json

It seems like npm or CRA is behaving like Maven and trying to recursivley process build scripts up the folder tree.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oliver Watkins