简体   繁体   English

React Native 报错:导出命名空间应该先由`@babel/plugin-proposal-export-namespace-from 转换

[英]React Native error: Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from

I am getting the following error when I am running react native application using react-native-cli当我使用react-native-cli运行 react native 应用程序时出现以下错误

error: node_modules\react-native-reanimated\src\index.ts: 
D:\Desktop\coding\Github\Stocksy\node_modules\react-native-reanimated\src\index.ts: 
Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.

I am attaching the screenshot of error I am getting with my system configuration我附上了我的系统配置错误的屏幕截图在此处输入图像描述

System Config系统配置在此处输入图像描述

Try this: -尝试这个: -

  1. npm install react-native-reanimated

  2. In babel.config.js insert plugins: ['react-native-reanimated/plugin'] (make sure its at the end, it should look like this: -在 babel.config.js 中插入插件: ['react-native-reanimated/plugin'] (确保它在最后,它应该看起来像这样:-

    module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: ['react-native-reanimated/plugin'], }; module.exports = { 预设:['module:metro-react-native-babel-preset'],插件:['react-native-reanimated/plugin'],};

  3. run react-native start --reset-cache运行 react-native start --reset-cache

  4. run your native app (For ios example - npx react-native run-ios)运行您的本机应用程序(例如 ios - npx react-native run-ios)

What you have to do is add this config to your babel.config.js and restart your app.您需要做的就是将此配置添加到您的babel.config.js并重新启动您的应用程序。 plugins: ['react-native-reanimated/plugin'],插件:['react-native-reanimated/plugin'],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有 Babel plugin-proposal-export-default-from 的 ESLint - ESLint with Babel plugin-proposal-export-default-from 如何在 Babel 中将 * 导出为命名空间? - How can I export * as namespace in Babel? 导出名称空间功能未定义 - export namespace function is undefined JavaScript中的名称空间是什么,以及如何从名称空间导出方法? - What's namespace in JavaScript and how to export method from namespace? 出现“错误:插件/预设文件不允许导出对象,只能导出功能。” 来自 babel-preset-react-app/index.js - Getting "Error: Plugin/Preset files are not allowed to export objects, only functions." from babel-preset-react-app/index.js Babel错误:插件/预设文件不允许导出对象,仅可导出功能 - Babel Error: Plugin/Preset files are not allowed to export objects, only functions 错误:找不到模块“@babel/plugin-proposal-class-properties” - Error: Cannot find module '@babel/plugin-proposal-class-properties' “export default from”不适用于Babel React - “export default from” doesn't work with Babel React Typescript导出模块显式创建新的名称空间? - Typescript export module explicitly creates new namespace? 如何在Typescript中使用其他名称导出名称空间 - How to export a namespace with another name in Typescript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM