使用UI-Kitten与Expo打包Web应用时编译失败求助
Expo + UI-Kitten Web打包失败问题
我正在尝试将基于UI-Kitten与Expo开发的应用打包为Web版本,但遇到了UI-Kitten相关的编译错误。应用在安卓模拟器上能正常运行,但Web打包始终失败。
执行的打包命令
npx expo export:web
编译失败错误信息
Failed to compile
CommandError: Module parse failed: Unexpected token (19:16)
File was processed with these loaders:
- ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| // @ts-ignore - UI Kitten components pass heretintColor
| const fillColor = react_native_1.StyleSheet.flatten(style || {}).tintColor;return (<Icon style={props.style} fill={fillColor} {...svgProps}/>);| }
| }
安装依赖时的npm警告
npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: react-native-eva-icons@1.3.1 npm WARN Found: react-native-svg@13.4.0 npm WARN node_modules/react-native-svg npm WARN peer react-native-svg@"*" from @ui-kitten/eva-icons@5.3.1 npm WARN node_modules/@ui-kitten/eva-icons npm WARN @ui-kitten/eva-icons@"^5.3.1" from the root project npm WARN 2 more (the root project, @ui-kitten/components) npm WARN npm WARN Could not resolve dependency: npm WARN peer react-native-svg@"^9.4.0" from react-native-eva-icons@1.3.1 npm WARN node_modules/@ui-kitten/eva-icons/node_modules/react-native-eva-icons npm WARN react-native-eva-icons@"^1.3.1" from @ui-kitten/eva-icons@5.3.1 npm WARN node_modules/@ui-kitten/eva-icons npm WARN npm WARN Conflicting peer dependency: react-native-svg@9.13.6 npm WARN node_modules/react-native-svg npm WARN peer react-native-svg@"^9.4.0" from react-native-eva-icons@1.3.1 npm WARN node_modules/@ui-kitten/eva-icons/node_modules/react-native-eva-icons npm WARN react-native-eva-icons@"^1.3.1" from @ui-kitten/eva-icons@5.3.1 npm WARN node_modules/@ui-kitten/eva-icons
已尝试的解决操作
- 查阅资料后怀疑react-native-svg与eva-icons版本不兼容,参照UI-Kitten文档多次尝试重新安装不同版本的react-native-svg与react-native-eva-icons,但问题未解决。
- 执行命令
expo install react-native-svg@9.13.6,多次重新安装图标相关包,仍出现相同错误。
当前项目package.json内容
{ "name": "easy-meets", "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": { "@eva-design/eva": "^2.2.0", "@expo/webpack-config": "^18.0.1", "@react-native-async-storage/async-storage": "1.17.11", "@react-native-community/geolocation": "^3.0.6", "@react-navigation/bottom-tabs": "^6.5.7", "@react-navigation/material-top-tabs": "^6.6.2", "@react-navigation/native": "^6.1.6", "@react-navigation/stack": "^6.3.16", "@supabase/supabase-js": "^2.22.0", "@ui-kitten/components": "^5.3.1", "@ui-kitten/eva-icons": "^5.3.1", "axios": "^1.4.0", "expo": "~48.0.15", "expo-font": "^11.1.1", "expo-location": "~15.1.1", "expo-status-bar": "~1.4.4", "force": "^0.0.3", "i": "^0.3.7", "npm": "^9.6.7", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.71.8", "react-native-pager-view": "6.1.2", "react-native-svg": "13.4.0", "react-native-swipe-cards": "^0.1.1", "react-native-tab-view": "^3.5.1", "react-native-url-polyfill": "^1.3.0", "react-native-web": "~0.18.10" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }
内容的提问来源于stack exchange,提问作者Adam Kostandy
相关产品推荐
相关产品推荐

