Reputation: 657
I am creating a React project from scratch without create-react-app. But it worked fine on my mac but not on my other ubuntu laptop. Below is my previous .babelrc file content.
"presets": [
"@babel/preset-react",
"@babel/preset-env"
]
It works fine on my mac (npm version 6.12.0) but not on ubuntu(npm version 6.14.5) It shows error that can't compile src/index.js -> below line
ReactDOM.render(<App />, document.getElementById('root'));
So I changed .babelrc env file to
"presets": [
"@babel/react",
"@babel/env"
]
And it worked on both finally. But I am not sure exactly the difference between @babel/preset-react and @babel/react. If anyone knows exact difference between these two, please let me know. Thanks for your help!
Upvotes: 5
Views: 5464
Reputation: 717
https://babeljs.io/docs/en/v7-migration#package-renames
{
- "presets": ["@babel/preset-react"],
+ "presets": ["@babel/react"], // this is equivalent
- "plugins": ["@babel/transform-runtime"],
+ "plugins": ["@babel/plugin-transform-runtime"], // same
}
Upvotes: 1