升级Expo SDK 52时遇Babel错误:.plugins不是有效插件属性
Expo SDK 52升级时遇到Babel
.plugins is not a valid Plugin property 错误求助 项目配置
package.json
{ "name": "app-mobile", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", "web": "npx expo start --web" }, "dependencies": { "@react-native-async-storage/async-storage": "1.17.11", "@react-native-picker/picker": "2.4.8", "@react-navigation/bottom-tabs": "^6.5.7", "@react-navigation/native": "^6.1.6", "@react-navigation/native-stack": "^6.9.12", "axios": "^1.7.2", "expo": "~52.0.0", "expo-dev-client": "~2.2.1", "expo-linear-gradient": "^12.1.2", "expo-splash-screen": "~0.18.2", "expo-status-bar": "~1.4.4", "nativewind": "^2.0.11", "papaparse": "^5.4.1", "react": "18.2.0", "react-native": "0.72.0", "react-native-dropdown-picker": "^5.4.6", "react-native-fingerprint-scanner": "^6.0.0", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "~2.9.0", "react-native-heroicons": "^3.2.0", "react-native-modal": "^13.0.1", "react-native-ratings": "^8.1.0", "react-native-reanimated": "~2.14.4", "react-native-safe-area-context": "4.5.0", "react-native-screens": "~3.20.0", "react-native-star-rating": "^1.1.0", "react-native-svg": "13.4.0", "react-native-vector-icons": "^9.2.0", "tailwindcss": "^3.2.7" }, "devDependencies": { "@babel/core": "^7.22.17", "@types/react": "~18.2.14", "babel-preset-expo": "^9.2.0", "typescript": "^4.0.0" }, "private": true }
babel.config.js
module.exports = function(api) { api.cache(true); return { presets: ['babel-preset-expo'], plugins: ['nativewind/babel'], }; };
tailwind.config.js
/** @type {import('tailwindcss').Config} */ module.exports = { content: [ "./App.{js,jsx,ts,tsx}", "./screens/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}" ], theme: { extend: {}, }, plugins: [], };
postcss.config.js
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, };
index.js
import { registerRootComponent } from 'expo'; import App from './App'; registerRootComponent(App);
App.js
import { StatusBar } from 'expo-status-bar'; import { SafeAreaView, StyleSheet, Text, View } from 'react-native'; import AppNavigation from './navigation/appNavigation'; import { AuthProvider } from './hooks/AuthProvider'; export default function App() { return ( <AuthProvider> <AppNavigation /> <StatusBar style="auto" /> </AuthProvider> ); }
metro.config.js
// Learn more https://docs.expo.io/guides/customizing-metro const { getDefaultConfig } = require('expo/metro-config'); module.exports = getDefaultConfig(__dirname);
遇到的错误
- Babel错误:
ERROR index.js: [BABEL] C:\Users\salva\Desktop\Estia Code\app-mobile\index.js: .plugins is not a valid Plugin property
- iOS打包错误:
iOS Bundling failed 455ms C:\Users\salva\Desktop\Estia Code\app-mobile\index.js (1 module) ERROR index.js: [BABEL] C:\Users\salva\Desktop\Estia Code\app-mobile\index.js: .plugins is not a valid Plugin property
请求帮助
有没有人在升级到Expo SDK 52时遇到过.plugins is not a valid Plugin property错误?如果有,是如何解决的?关于该问题的成因或应采取的额外步骤,任何指导都将不胜感激。提前感谢帮助!
内容的提问来源于stack exchange,提问作者Salvatore Amideo
相关产品推荐
相关产品推荐

