如何解决模块解析失败:意外令牌 (11:9) react-router-native [英] How can I solve the Module parse failed: Unexpected token (11:9) react-router-native
本文介绍了如何解决模块解析失败:意外令牌 (11:9) react-router-native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 yarn 安装了 react-native-router 并且只导入了 NativeRouter
I installed react-native-router using yarn and just on importing NativeRouter
这就是我从 react-router-native 导入的方式import { NativeRouter, Route, Link } from "react-router-native";
This is how I import from react-router-native import { NativeRouter, Route, Link } from "react-router-native";
这是我得到的错误
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} />;
| }
|
推荐答案
有同样的错误.通过添加修复:
Had the same error. Fixed by adding:
"web": {
"build": {
"babel": {
"include": ["react-router-native"]
}
}
}
到 app.json
来自:来源
这篇关于如何解决模块解析失败:意外令牌 (11:9) react-router-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文