I\'m launching a react app, and here\'s my Webpack configuration:
\'use strict\'
const ExtractPlugin = require(\'extract-text-webpack-plugin\')
const HTMLPl
Before in my .babelrc
i was using the plugin: ["transform-object-rest-spread", { "useBuiltIns": true }],
then i switch it to "@babel/plugin-proposal-object-rest-spread"
and all those warnings went away, which has been very nice.
`
In my case, I was not implementing the Webpack configuration and still error was there. After so many solutions implementation, the error was same or once an error was removed another appeared. Finally, I deleted .bablerc
, .babelrc
and package-lock.json
files and ran rm -rf node_modules && npm install
and then ran react-native run-android
and it worked for me. :-)
If nothing up here worked, Just remove plugins from old babel. In my case removing following spread plugin had disappeared the thing.
plugins: ["transform-object-rest-spread"]
This issue is occurring due to using outdated
`"babel-plugin-transform-object-rest-spread"`
update this in package.json
`"@babel/plugin-proposal-object-rest-spread": "^7.0.0",`
and update your .babelrc.js file in my case it looks like this
const isTest = String(process.env.NODE_ENV) === 'test'
module.exports = {
presets: [["@babel/env", { modules: isTest ? 'commonjs' : false }, "@babel/react"]],
plugins: [
'syntax-dynamic-import',
'transform-class-properties',
'@babel/plugin-proposal-object-rest-spread',
],
}
this solves my problem
here is the final setting that solved problem for me.
.babelrc
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
For a better understanding, here is my package.json's devDependencies:
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/plugin-transform-react-jsx": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"babel-loader": "8.0.4",
"prop-types": "15.6.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"style-loader": "^0.23.1",
"utils": "^0.3.1",
"webpack": "4.26.1",
"webpack-cli": "3.1.2",
"webpack-dev-server": "^3.1.10"
}
Here is my webpack.config.js module's section:
module: {
rules: [
{
test: /\.(js|jsx)$/ ,
exclude: /node_modules/,
loaders: "babel-loader"
}
]
}