create-react-app (TypeScript) .babelrc throwIfNamespace=true setting

Viewed 1857

thought this would be simple but it's not. I generated a simple app with the latest create-react-app. Adding a <gcse:search> tag and getting the following:

Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can turn on the 'throwIfNamespace' flag to bypass this warning.
  16 |         return (
  17 |             <div className="comptext">
> 18 |                 <gcse:search defaultToRefinement="mostly-center"></gcse:search>
     |                  ^
  19 |             </div>
  20 |         );

.babelrc is:

{
    "presets": [
        [
            "@babel/preset-react",
            {
                "throwIfNamespace": false
            }
        ]
    ]
}

I've tried multiple .babelrc configurations, "babel" key in package.json, even tried including .bablerc.js. No change

I'd prefer to not eject this, if possible.

What am I missing?

1 Answers

You need to set it as follow:

"throwIfNamespace"`: false in file `@babel/preset-react/index.js

Related