You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native中dynamic import失败,抛出‘unknown module’错误求助

React Native中添加import()语句触发"unknown module"错误

我尝试配置Reactotron,按官方快速开始步骤操作后,发现问题和Reactotron无关:只要在项目的App.js文件中添加import()语句,就会出现“unknown module”警告/错误。我已经多次执行npm install,也更新了所有依赖包,以下是项目的package.json配置:

{
  "name": "my-app",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-navigation/bottom-tabs": "^6.5.9",
    "@react-navigation/drawer": "^6.6.4",
    "@react-navigation/elements": "^1.3.19",
    "@react-navigation/native": "^6.1.8",
    "@react-navigation/native-stack": "^6.9.14",
    "@react-navigation/stack": "^6.3.18",
    "@reduxjs/toolkit": "^1.9.6",
    "axios": "^1.5.1",
    "expo": "^49.0.13",
    "expo-checkbox": "~2.4.0",
    "expo-linear-gradient": "~12.3.0",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-native": "0.72.5",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-paper": "^5.10.6",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-vector-icons": "^10.0.0",
    "react-redux": "^8.1.2",
    "url": "^0.11.3"
  },
  "devDependencies": {
    "@babel/core": "^7.23.0",
    "reactotron": "^0.9.0",
    "reactotron-react-native": "^5.0.3"
  },
  "private": true
}

内容的提问来源于stack exchange,提问作者Pj Fani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 16:33:32