安装react-native-unimodules后编译React Native应用时出错

问题描述

这是我的第一个没有Expo的React Native项目,因为我正在使用react-native-firebase,并且我知道无法在Expo中使用它。但是,我希望通过使用Expo的Bare Workflow来使用我现在熟悉的几个Expo模块。为此,我显然需要安装react-native-unimodules,这是通过遵循installation guide来完成的。

但是我似乎无法正常工作。完成安装步骤并尝试运行该应用程序(在iOS模拟器或android模拟器上)后,或者如果我只是尝试编译bundle.js,我将收到以下错误消息:

error ▶︎ Failed to compile.
error ▶︎ ./node_modules/expo-asset/build/PlatformUtils.js 12:37
Module parse Failed: Unexpected token (12:37)
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
| // local assets available.
| export const IS_BARE_ENV_WITH_UPDATES = !IS_MANAGED_ENV &&
>     !!NativeModulesProxy.ExpoUpdates?.isEnabled &&
|     // if expo-updates is installed but we're running directly from the 
embedded bundle,we don't want
|     // to override the AssetSourceResolver
 @ ./node_modules/expo-asset/build/Asset.js 7:0-77 58:17-44 145:38-51
 @ ./node_modules/expo-asset/build/index.js
 @ ./node_modules/react-native-unimodules/build/index.js
 @ ./src/App.tsx
 @ ./index.js
 @ multi ./node_modules/react-native/Libraries/polyfills/console.js
./node_modules/react-native/Libraries/polyfills/error-guard.js
./node_modules/react-native/Libraries/polyfills/Object.es7.js
react-native/Libraries/Core/InitializeCore.js ./index
./node_modules/expo-asset/build/EmbeddedAssets.js 13:44

我尝试确保所有模块/吊舱都是最新的,清除并重新安装我能想到的所有组件,但无济于事。我不确定从哪里开始寻找调试此问题的方法。有什么想法吗?

更新:我正在使用Haul进行捆绑-这似乎是导致问题的原因。如果我回过头来使用本机cli,它会起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)