FaridSafi / react-native-gifted-chat

💬 The most complete chat UI for React Native
https://gifted.chat
MIT License
13.55k stars 3.56k forks source link

Failed to parse source map from ... #2398

Open pascal-mueller opened 1 year ago

pascal-mueller commented 1 year ago

Issue Description

I'm trying to add react-native-gifted-chat to my expo application. I added the example component given in the README. I get a lot of the following warnings.

WARNING in ./node_modules/react-native-gifted-chat/lib/logging.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/.../node_modules/react-native-gifted-chat/src/logging.ts' file: Error: ENOENT: no such file or directory, open '/home/pascal/projects/spark/spark-ui/node_modules/react-native-gifted-chat/src/logging.ts'

Now I observed the following:

`cat /home/.../node_modules/react-native-gifted-chat/src/logging.ts`

which gives `No such file or directory`, that's because there is no `src` dir in `node_modules/react-native-gifted-chat/` but there is `lib`. So the Error makes sense.

My question is: Why are those files missing?

#### Steps to Reproduce / Code Snippets

Here's my package.json

{
  "name": "myapp",
  "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": {
    "@expo/webpack-config": "^18.0.1",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "expo": "~48.0.15",
    "expo-crypto": "~12.2.1",
    "expo-secure-store": "~12.1.1",
    "expo-status-bar": "~1.4.4",
    "formik": "^2.2.9",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-lifecycles-compat": "^3.0.4",
    "react-native": "0.71.8",
    "react-native-base64": "^0.2.1",
    "react-native-gifted-chat": "^2.1.0",
    "react-native-web": "~0.18.10",
    "socket.io-client": "^4.6.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.0.27",
    "@types/react-native": "^0.72.1",
    "typescript": "^4.9.4"
  },
  "private": true
}

Expected Results

I expect the files of the dependency to exist.

Additional Information

See packagejson above:

LisaGenner commented 1 year ago

HI, I am running into the same or similar issue. where you able to resolve?

pascal-mueller commented 1 year ago

I didn't had time to look into it yet. Since the source maps are only used for debugging i.e. during development, it isn't critical for a functional application. You can basically ignore them since in production mode they shouldn't show up at all.

I used the env variable GENERATE_SOURCEMAP=false to get rid of the warnings since the files are simply not generated. You can add it to the scripts key in the package.json e.g. like this

    "scripts": {
        "start": "GENERATE_SOURCEMAP=false && expo start",
        "android": "expo start --android",
        "ios": "expo start --ios",
        "web": "expo start --web"
    },

but it doesn't do much since it doesn't work for hot reload. If I find the time to look into it in detail and I find the actual issue, I'd post here.

Lautarotetamusa commented 9 months ago

Hello, I'm running into the same issue.