如何启用对实验语法'exportDefaultFrom'的支持

问题描述 投票:0回答:1

将React Navigation添加到我的Web应用程序项目后,它无法编译。首先,它引发了这个错误:

Attempted import error: 'DrawerActionHelpers' is not exported from './DrawerRouter'

我在这里尝试了解决方案:How to remove reach navigation 5.x warnings

似乎对某些事情有所帮助。

所以我试图再次编译它,然后把它扔给我:

     Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled (30:8):

  28 | const SETTLING = 'Settling';
  29 | 
> 30 | export type PropType = {
     |        ^
  31 |   children: any,
  32 |   drawerBackgroundColor?: string,
  33 |   drawerPosition: 'left' | 'right',

Add @babel/plugin-proposal-export-default-from (https://git.io/vb4yH) to the 'plugins' section of your Babel config to enable transformation.

所以我在项目中添加了@babel/plugin-proposal-export-default-from。还添加了以下代码:

{
  "plugins": ["@babel/plugin-proposal-export-default-from"]
}

到我的.bablerc配置文件,在我的项目根目录中。

现在,当我尝试编译它时,它仍然会抛出相同的@babel/plugin-proposal-export-default-from错误。

reactjs react-native react-navigation babel
1个回答
0
投票

我在反应导航中遇到相同的问题。我曾尝试降级react-nativ-web,但仍然没有锁定

© www.soinside.com 2019 - 2024. All rights reserved.