Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I solve the Module parse failed: Unexpected token (11:9) react-router-native

I installed react-native-router using yarn and just on importing NativeRouter

This is how I import from react-router-native import { NativeRouter, Route, Link } from "react-router-native";

This is the error I get

D:/WORKSHOP/Tunga/music-app/node_modules/react-router-native/NativeRouter.js 11:9
Module parse failed: Unexpected token (11:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  */
| function NativeRouter(props) {
>   return <MemoryRouter {...props} />;
| }
|
like image 433
iamafasha Avatar asked Apr 11 '20 16:04

iamafasha


1 Answers

Had the same error. Fixed by adding:

"web": {
  "build": {
    "babel": {
      "include": ["react-router-native"]
    }
  }
}

to app.json

From: source

like image 82
Kyrill Avatar answered Sep 23 '22 02:09

Kyrill