We are trying to import the react-native-fetch-blob package package using the following code:
const RNFetchBlob = require('react-native-fetch-blob');
const firebase = require('firebase');
However, when we try and build, we get a Syntax Error for Unexpected token import as follows.
C:\Users\ ...\node_modules\react-native-fetch-blob\index.js:5
import {
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\ ...\build\cloud\file.js:159:243) at Module._compile (module.js:541:32)
We are using ES6 and our .babelrc file looks as follows
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
],
"presets": ["react-native","es2015",]
Is there a solution to this? Any help would be greatly appreciated!
Thanks!