react-native-fetch-blob icon indicating copy to clipboard operation
react-native-fetch-blob copied to clipboard

Unexpected token import

Open ddaaggeett opened this issue 7 years ago • 2 comments

I followed the setup instructions and get the following upon starting the react-native server:

/Users/.../node_modules/react-native-fetch-blob/index.js:5
import {
^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    ...

I understand this has something to do with using babel.js, but I keep digging myself in circles.

Here's another user's StackOverflow question that needs answering.

ddaaggeett avatar Apr 27 '17 03:04 ddaaggeett

having the same problem but only when running jest tests.

schumannd avatar Aug 28 '18 14:08 schumannd

This should be able to fix the issue. Add to your jest setup.

"transform": {
  "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
},

nonewcode avatar Dec 10 '18 14:12 nonewcode