'com.facebook.react.commot.JavascriptException: Invalid or unexpected token

I'm trying to debug my android app with react native v0.66.1 and react native tools v1.8.1 in vsCode. But after running the app and attach to packager, or launch in debug mode, I got this error com.facebook.react.commot.JavascriptException: Invalid or unexpected token.

enter image description here



Solution 1:[1]

update babel.config.js of your project : (assume your metro-react-native-babel-preset is 0.58.0) from:

module.exports = {
   presets: ['module:metro-react-native-babel-preset'],
};

to:

module.exports = {
   presets: [['module:metro-react-native-babel-preset', {
        unstable_disableES6Transforms: true
    }]],
};

finally run yarn start --reset-cache to restart app.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jitendrasinh Zala