i have created an application from create-react-app and it works well. When I added react-navitation I got this error:
我已经从create-react-app创建了一个应用程序,它运行良好。当我添加react-navitation时,我收到了这个错误:
./node_modules/react-navigation/src/routers/StackActions.js
Module parse failed: Unexpected token (10:2)
You may need an appropriate loader to handle this file type.
| const pop = payload => ({
| type: POP,
| ...payload,
| });
|
It seens we don't have "transform-object-rest-spread" babel plugin. Could someone knows how may I add it?
它认为我们没有“transform-object-rest-spread”babel插件。有人知道我怎么可以添加它?
this is my dependencies inside package.json:
这是我在package.json中的依赖项:
"dependencies": {
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-navigation": "^2.6.2",
"react-scripts": "1.1.4"
}
1 个解决方案
#1
0
From this issue: https://github.com/react-navigation/react-navigation/issues/3516
从这个问题:https://github.com/react-navigation/react-navigation/issues/3516
we don't explicitly support web or reactxp currently. if you'd like to submit a RFC for how we could do that and own it, it would be nice. it's not a priority right now. so this is more of a feature request than a bug. sorry :(
我们目前没有明确支持web或reactxp。如果您想提交RFC以了解我们如何做到并拥有它,那就太好了。现在不是优先事项。所以这更像是一个功能请求,而不是一个bug。对不起:(
See also this section of their docs.
另见本文档的这一部分。
TL;DR -- they ship un-transpiled code and are targeting React Native. I would suggest looking at alternatives, such as the tried-and-true react-router, or a newer one from one of the original authors, reach-router.
TL; DR - 他们发布未经编译的代码,并以React Native为目标。我建议寻找替代方案,例如经过验证的反应路由器,或者来自其中一位原作者,即路由器的新路由器。
#1
0
From this issue: https://github.com/react-navigation/react-navigation/issues/3516
从这个问题:https://github.com/react-navigation/react-navigation/issues/3516
we don't explicitly support web or reactxp currently. if you'd like to submit a RFC for how we could do that and own it, it would be nice. it's not a priority right now. so this is more of a feature request than a bug. sorry :(
我们目前没有明确支持web或reactxp。如果您想提交RFC以了解我们如何做到并拥有它,那就太好了。现在不是优先事项。所以这更像是一个功能请求,而不是一个bug。对不起:(
See also this section of their docs.
另见本文档的这一部分。
TL;DR -- they ship un-transpiled code and are targeting React Native. I would suggest looking at alternatives, such as the tried-and-true react-router, or a newer one from one of the original authors, reach-router.
TL; DR - 他们发布未经编译的代码,并以React Native为目标。我建议寻找替代方案,例如经过验证的反应路由器,或者来自其中一位原作者,即路由器的新路由器。