@llamaluvr, can you post the rest of your package.json
? I tried a simplified version of your config, but I still have problems…
I have this .babelrc:
{
"presets": ["babel-preset-expo"],
"plugins": ["transform-react-jsx-source", "transform-decorators-legacy"]
}
… and this is my package.json:
{
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"test": "node ./node_modules/jest/bin/jest.js --watchAll",
"start": "exp start --lan --dev",
"start_no-dev": "exp start --lan --no-dev",
"start_tunnel": "exp start --tunnel",
"start_redirect": "exp start --redirect"
},
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"/node_modules/(?!native-base)/"
]
},
"dependencies": {
"@expo/samples": "2.1.1",
"@expo/vector-icons": "^6.2.2",
"@feathersjs/authentication-client": "^1.0.2",
"@feathersjs/feathers": "^3.1.2",
"@feathersjs/socketio-client": "^1.1.0",
"expo": "^25.0.0",
"mobx": "^3.5.1",
"mobx-react": "^4.4.1",
"native-base": "^2.3.8",
"react": "16.2.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
"react-native-gifted-chat": "^0.3.0",
"react-navigation": "^1.0.0-beta.27",
"socket.io-client": "^2.0.4"
},
"devDependencies": {
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-remove-console": "^6.8.5",
"babel-preset-stage-2": "^6.24.1",
"jest-expo": "^25.1.0"
}
}
as soon as I include this import:
import {observer} from 'mobx-react/native';
I get this error message when running yarn test
:
FAIL __tests__\App-test.js
● Test suite failed to run
Couldn't find preset "es2015" relative to directory "C:\\cl\\lrn\\pera\\pera
-app\\node_modules\\mobx-react"
So I tried yarn add --dev babel-preset-es2015
. That added to my devDependencies:
"babel-plugin-transform-remove-console": "^6.8.5",
"babel-preset-es2015": "^6.24.1",
Now, I modified .babelrc to be almost identical to yours:
{
"presets": ["babel-preset-expo"],
"plugins": ["transform-react-jsx-source", "transform-decorators-legacy"],
"env": {
"production": {
"plugins": ["transform-remove-console"]
}
}
}
Now I get this error when running yarn test
:
FAIL __tests__\App-test.js
● Test suite failed to run
Couldn't find preset "stage-0" relative to directory "C:\\cl\\lrn\\pera\\per
a-app\\node_modules\\mobx-react"
I previously tried to add the “stage-0” Babel preset and that brought tons of new errors in the depths of React. Any idea?
Thanks a lot,
Christian