I have a monorepo that is set according to this tutorial: tutorial.
This project is composed by a main folder (series4) that holds three packages, which are focused on web, mobile applications and common code - they are named web, app and common folders respectively.
Summarizing ... these folders are:
/series4/packages/web
/series4/packages/common
/series4/packages/app
I am trying to use the Modal module, however I get this error:
SyntaxError: series4/node_modules/react-native-modal/src/index.js: Support for the experimental syntax 'classProperties' isn't currently enabled (25:20)
I have read the documentation that is here: Babel.
However I was not able to solve this error.
The package.json that is in "series4" directory is:
{
"name": "@wow/common",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "rimraf dist && tsc",
"watch": "tsc --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"react": "16.8.2",
"react-native": "0.59.0-rc.1",
"react-native-elements": "^1.1.0",
"react-native-image-slider-box": "^1.0.5",
"react-native-snap-carousel": "^3.8.0"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@types/react-native": "0.57.36",
"rimraf": "^2.6.3",
"typescript": "3.3.3"
}
}
The babel.config.js file (it is in series4 directory) is:
module.exports = {
presets: [
"@babel/preset-env",
"@babel/preset-react"
],
plugins: [
'@babel/proposal-class-properties',
'@babel/plugin-proposal-class-properties'
],
babelrcRoots: [
".",
"packages/*",
],
};
I have configured the following babelrc in web and common folders.
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties"
]
]
}
The package.json in common folder is:
{
"name": "@wow/common",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "rimraf dist && tsc",
"watch": "tsc --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"react": "16.8.2",
"react-native": "0.59.0-rc.1",
"react-native-elements": "^1.1.0",
"react-native-image-slider-box": "^1.0.5",
"react-native-snap-carousel": "^3.8.0"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@types/react-native": "0.57.36",
"rimraf": "^2.6.3",
"typescript": "3.3.3"
}
}
The package.json in web folder is:
{
"name": "react-native-web-workout-series",
"version": "0.1.0",
"private": true,
"dependencies": {
"@types/jest": "24.0.5",
"@types/node": "11.9.4",
"@types/react": "16.8.3",
"@types/react-dom": "16.8.1",
"@wow/common": "1.0.0",
"react": "^16.8.2",
"react-art": "16.8.2",
"react-dom": "^16.8.2",
"react-native": "0.55.4",
"react-native-modal": "^11.3.1",
"react-native-web": "0.10.0",
"react-scripts": "2.1.5",
"typescript": "3.3.3"
},
"scripts": {
"start": "cross-env SKIP_PREFLIGHT_CHECK=true react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@types/react-native": "0.55.4",
"babel-plugin-module-resolver": "^3.2.0",
"cross-env": "^5.2.0"
}
}
I get the error when I run the
yarn start
command in web folder (the command works perfectly when I execute it without the Modal module).
What am I missing?