expo failed to compile using when running in web browser?

350 Views Asked by At

I am a Linux user. I tried to run project in web browser but I am getting this error:

Failed to compile.
./node_modules/@twotalltotems/react-native-otp-input/dist/index.js 133:20
Module parse failed: Unexpected token (133:20)
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
|             const { clearInputs, placeholderCharacter, placeholderTextColor } = this.props;
|             const { color: defaultPlaceholderTextColor } = { ...defaultTextFieldStyle, ...codeInputFieldStyle };
>             return (<View pointerEvents="none" key={index + "view"} testID="inputSlotView">
|                 <TextInput testID="textInput" underlineColorAndroid='rgba(0,0,0,0)' style={selectedIndex === index ? [defaultTextFieldStyle, codeInputFieldStyle, codeInputHighlightStyle] : [defaultTextFieldStyle, codeInputFieldStyle]} ref={ref => { this.fields[index] = ref; }} onChangeText={text => {
|                 this.handleChangeText(index, text);

I searched on StackOverflow and found two related answers to add this to app.json:

 "web": {
    "build": {
      "babel": {
        "include": [
          "native-base-shoutem-theme"
          
          // "static-container" // another answer was 
          // I included both too but did not work
        ]
      }
    }
  }

Based on solution here https://github.com/expo/expo/issues/6157, i included the package:

 "include": ["@twotalltotems"]

but this gave me a much more sophisticated error

0

There are 0 best solutions below