web-dev-qa-db-fra.com

"Vous avez besoin de chargeurs appropriés", en utilisant React Native and Expo. L'application ne parvient pas à compiler sur le Web, mais fonctionne sur android

J'utilise React Native Expo. L'application fonctionne bien sur Android, mais lorsque vous exécutez sur le Web obtient une erreur de compilation. Cela fonctionnait bien auparavant, mais je soupçonne que cela a commencé après avoir installé un nouveau colis.

/ReactNativeFrontend/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js 13:12
Module parse failed: Unexpected token (13:12)
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
| } from 'react-native'
| import { isIphoneX } from 'react-native-iphone-x-helper'
> import type { KeyboardAwareInterface } from './KeyboardAwareInterface'
| 
| const _KAM_DEFAULT_TAB_BAR_HEIGHT: number = isIphoneX() ? 83 : 49

Mon babel config

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
  };
};

Mon paquet.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "Android": "expo start --Android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@codler/native-base": "^2.14.2",
    "@material-ui/core": "^4.11.0",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/async-storage": "^1.11.0",
    "@react-native-community/datetimepicker": "^2.4.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/voice": "^1.1.6",
    "@risingstack/react-easy-state": "^6.3.0",
    "axios": "^0.19.2",
    "easy-peasy": "^3.3.1",
    "expo": "~38.0.8",
    "expo-camera": "^8.3.1",
    "expo-constants": "^9.1.1",
    "expo-font": "~8.2.1",
    "expo-gl": "^8.3.1",
    "expo-image-picker": "^8.3.0",
    "expo-permissions": "^9.0.1",
    "expo-pixi": "^1.2.0",
    "expo-speech": "~8.2.1",
    "expo-status-bar": "^1.0.2",
    "i18n-js": "^3.7.1",
    "lodash.memoize": "^4.1.2",
    "native-base": "^2.13.12",
    "proxy": "^1.0.2",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-instantsearch-native": "^6.7.0",
    "react-native-chatbot": "0.0.1-alpha.12",
    "react-native-datepicker": "^1.7.2",
    "react-native-dialogflow": "^3.2.2",
    "react-native-elements": "^2.0.4",
    "react-native-fade-in-view": "^1.1.0",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-localization": "^2.1.6",
    "react-native-localize": "^1.4.1",
    "react-native-no-flicker-image": "^1.0.2",
    "react-native-paper": "^4.0.1",
    "react-native-reanimated": "~1.9.0",
    "react-native-safe-area-context": "~3.0.7",
    "react-native-screens": "~2.9.0",
    "react-native-signature-capture": "^0.4.10",
    "react-native-star-rating": "^1.1.0",
    "react-native-vector-icons": "^7.0.0",
    "react-native-voice": "^0.3.0",
    "react-native-web": "~0.11.7",
    "react-navigation": "^4.4.0",
    "react-navigation-stack": "^2.8.2",
    "react-navigation-tabs": "^2.9.0",
    "styled-components": "^5.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "@babel/preset-env": "^7.11.0",
    "babel-preset-expo": "~8.1.0",
    "react-native": "^0.63.2"
  },
  "private": true,
  "rnpm": {
    "assets": "./assets/fonts"
  },
  "proxy": "http://localhost:19002"
}

Comment ajouter des chargeurs appropriés ou identifier le paquet provoquant ce problème.

7
jackson jose

Ceci est un problème de bibliothèque de base natif. Pendant que vous utilisez, il y a des composants, une erreur peut se produire. J'ai constaté que cette erreur ne se produit pas en 2.11 ou c'est moins la version, essayez donc d'installer cette version spécifique.

npm install [email protected]
1
Shivam Modi