I am getting this error message
"src\\screens\\LoginScreen.js: Cannot use the decorators and decorators-legacy plugin together ERROR Building JavaScript bundle: error"
here is my babel.config.js
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ["transform-decorators-legacy"]
};
};
I add babel-plugin-transform-decorators-legacy to devDepencies in package.json file
"devDependencies": {
"babel-preset-expo": "^7.1.0",
"react-native-debugger-open": "^0.3.23",
"babel-plugin-transform-decorators-legacy": "1.3.5"
},
try this
npm install @babel/plugin-proposal-decorators @babel/plugin-proposal-class-properties @babel/plugin-transform-flow-strip-types --save
And then you have to change babel.config.js like below;
module.exports = {
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["@babel/plugin-transform-flow-strip-types"],
["@babel/plugin-proposal-decorators", { "legacy": true}],
["@babel/plugin-proposal-class-properties", { "loose": true}]
]
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.