I got the same error with babel 7.x and and "babel-loader": "^8.0.4"
I solved the issue by changing the following dependencies in package.json.
I got the solution from these link
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.4",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2"
}
and in .babelrc
{
"presets": ["@babel/env", "@babel/react"]
}
or in package.json
"babel": {
"presets": [
"@babel/env",
"@babel/react"
]
},
If you are using npm then use the following
npm install @babel/core --save-dev
npm install @babel/preset-env --save-dev
npm install @babel/preset-react --save-dev
npm install babel-loader --save-dev
npm install webpack --save-dev
npm install webpack-cli --save-dev
If you are using yarn, then use the following
yarn add @babel/core --dev
yarn add @babel/preset-env --dev
yarn add @babel/preset-react --dev
yarn add babel-loader --dev
yarn add webpack --dev
yarn add webpack-cli --dev