Ok You do import React…
This is how I did for a babel 7.4.3 and React 16.8
I use a babel.config.js with this inside
module.exports = api => {
api.cache(true);
const presets = [
[
"@babel/preset-env",
{
targets: {
edge: "17",
firefox: "60",
chrome: "67",
safari: "11.1",
},
useBuiltIns: "usage",
corejs: '3.0.0',
},
"@babel/preset-react",
],
];
const plugins = [
];
return {
presets,
plugins
};
}
I think I got this config on the babel site.
You may adapt for your usage.
In webpack.config.js, I have
{
test: /\.jsx?$/,
include: SRC_PATH,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
rootMode: "upward",
},
},
BTW, as a minor note… I put react, react-dom in dependencies, and all @babel… in devDependencies






















