-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to compile ./node_modules/react-router-native/NativeRouter.js #5684
Comments
Something is wrong with your build tooling. This isn't a problem with react router. |
So |
The error seems to be because |
Figured it out. Apparently Thanks! |
What was the solution ! THe link is brokenn :( |
@ethanneff can you elaborate more on this? Was it just a transpiling issue? If so, you need to make sure const path = require('path');
const appDirectory = path.resolve(__dirname, '../');
module.exports {
...
test: /\.(js|jsx|mjs)$/,
include: [
path.resolve(appDirectory, 'src')
path.resolve(appDirectory, 'node_modules/react-router-native')
],
loader: require.resolve('babel-loader'),
...
} |
Version
react-router-native
4.2.0Test Case
I am using
create-react-app
(react-scripts start
) with React Native. Everything works fine until I addreact-router-native
code. I get the following error:Am I missing something in the setup process? I am using this guide https://github.com/ReactTraining/react-router/tree/master/packages/react-router-native
Steps to reproduce
import React from "react"; import { StyleSheet, Text, View } from "react-native"; + import { NativeRouter, Route } from "react-router-native"; const page = props => { return ( <View style={styles.container}> <Text>Test</Text> </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#fff", alignItems: "center", justifyContent: "center" } }); export default page;
package.json
{ "devDependencies": { "@commitlint/cli": "^4.2.2", "@commitlint/config-angular": "^4.2.1", "coveralls": "^3.0.0", "gh-pages": "^1.0.0", "husky": "^0.14.3", "jest-expo": "^22.0.0", "lint-staged": "^4.3.0", "prettier": "^1.7.4", "react-devtools": "^2.5.2", "react-native-scripts": "1.6.0", "react-native-web": "^0.1.13", "react-scripts": "^1.0.16", "react-test-renderer": "16.0.0", "remote-redux-devtools": "^0.5.12" }, "dependencies": { "expo": "^22.0.0", "react": "16.0.0", "react-dom": "^16.0.0", "react-native": "^0.50.0", + "react-router-native": "^4.2.0" } }
.babelrc
Expected Behavior
render
Actual Behavior
error
The text was updated successfully, but these errors were encountered: