I\'ve a problem and somehow I just can\'t solve it. I tried everything for hours but I just don\'t find a solution. It worked in older projects, but doesn\'t work with a bra
After searching for a while, I found a solution for the problem. It works without ejecting.
The Problem & the way I found a solution:
At some point in the past, react decided to remove some babel presets from their react-app presets. I compared the "babel-preset-react-app" (folder inside node_modules) from an older project, with the babel-presets from a newly created react app (created with create-react-app v3.4). By comparing the package.json from the babel-preset-react-app from both applications, I found out that in the newer version, there are much less babel plugins installed.
The solution: Install the @babel/plugin-proposal-object-rest-spread (and maybe also the @babel/plugin-transform-spread just to be sure) by running:
npm install @babel/plugin-proposal-object-rest-spread @babel/plugin-transform-spread
Once done, simply add them as plugins inside the package.json of your react app, below the imported presets from react:
"babel": {
"presets": [ // This line should already be there if you created your project with CRA
"react-app"
],
"plugins": [
"@babel/plugin-transform-spread",
"@babel/plugin-proposal-object-rest-spread"
]
}
I hope this helped!