【问题标题】:How can I solve the Module parse failed: Unexpected token (11:9) react-router-native如何解决 Module parse failed: Unexpected token (11:9) react-router-native
【发布时间】:2020-07-24 08:39:34
【问题描述】:

我使用 yarn 安装了 react-native-router 并且只是在导入 NativeRouter

这就是我从 react-router-native 导入的方式 从“react-router-native”导入 { NativeRouter, Route, Link };

这是我得到的错误

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} />;
| }
|

【问题讨论】:

    标签: react-native react-router-native


    【解决方案1】:

    有同样的错误。通过添加修复:

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

    到 app.json

    发件人:source

    【讨论】:

      猜你喜欢
      • 2021-12-03
      • 2019-02-13
      • 2022-12-03
      • 2021-09-25
      • 2020-05-09
      • 2017-08-01
      • 2017-12-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多