All,
I am trying to include babel-plugin-proposal-class-properties in my code bundle, but I get the following error;
2020-01-07 08:19:31.593 [error][tid:NSOperationQueue 0x2817acc40 (QOS: UNSPECIFIED)][RCTCxxBridge.mm:414] Failed to load bundle( http://169.254.99.36:8081/index.bundle?platform=ios&dev=true&minify=false ) with error:(index.js: Cannot find module 'babel-plugin-plugin-proposal-class-properties' from '/Users/bburch/Projects/systems/SystemsDockConfig' - Did you mean "@babel/plugin-proposal-class-properties"? (null))
My .babelrc looks like;
{ "presets": [
"@babel/env",
"@babel/react", ], "plugins": ["proposal-class-properties",] }
I also have tried this syntax;
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
In either case, somehow the "plugin" part of the package name is being doubled and of course the module is not found when that happens.
My package.json;
{
"name": "SystemsDockConfig",
"version": "0.0.2",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-syntax-object-rest-spread": "^7.7.4",
"@babel/preset-env": "^7.7.7",
"buffer": "^5.0.7",
"eslint": "^6.8.0",
"eventemitter3": "^4.0.0",
"native-base": "^2.13.8",
"react": "16.8.3",
"react-native": "0.59.10",
"react-native-ble-plx": "1.1.0",
"react-native-camera": "^1.0.0",
"react-native-router-flux": "^4.0.6",
"react-native-version-number": "^0.3.1",
"react-native-wheel-datepicker": "^2.1.8"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/runtime": "^7.6.3",
"babel-jest": "^24.9.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
I suggest you change your .babelrc to babel.config.json and use{ make sure you install
npm i --save-dev @babel/plugin-proposal-class-properties
this should work bable.config.json
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
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.