Ionic 4 File transfer Error: Object(…) is not a function


i am trying to make a file transfer functionality into my app using file-transfer, file chooser and file path.

Now file chooser and file path work fine, but file-transfer gives me a webpack require error.

error message

Uncaught TypeError: Object(...) is not a function
    at index.js:200
    at Module../node_modules/@ionic-native/file-transfer/index.js (index.js:217)
    at __webpack_require__ (bootstrap:83)
    at Module../src/app/app.module.ts (app.component.ts:11)
    at __webpack_require__ (bootstrap:83)
    at Module../src/main.ts (main.ts:1)
    at __webpack_require__ (bootstrap:83)
    at Object.0 (main.ts:12)
    at __webpack_require__ (bootstrap:83)
    at checkDeferredModules (bootstrap:45)

file transfer has been imported in app.module and added as provider. but then the app crashes and it gives that error back.

i have tried to only add the file-transfer to the designated page, but no luck there.


    <plugin name="cordova-plugin-file-transfer" spec="1.7.1" />
    <plugin name="cordova-plugin-filechooser" spec="1.2.0" />
    <plugin name="cordova-plugin-filepath" spec="1.5.1" />


    "cordova-plugin-file-transfer": "1.7.1",
    "cordova-plugin-filechooser": "1.2.0",
    "cordova-plugin-filepath": "1.5.1",

I would like to have the plugin working, but im not sure if file-transfer works with ionic 4.
I installed file-transfer using

ionic cordova plugin add cordova-plugin-file-transfer
npm install --save @ionic-native/file-transfer

Hi B3nvo,
Please import the FileTransfer ‘@ionic-native/file-transfer/ngx’. Please check your import statement.

import { FileTransfer, FileUploadOptions, FileTransferObject } from ‘@ionic-native/file-transfer/ngx’

after installing the beta version of file transfer i was able to add it with /ngx.

i didn’t install the beta version so it had no ngx folder.

after installing the beta and importing using /ngx the plugin started working.

but what i came across previously, i can’t import FileUploadOptions in the providers.

'FileUploadOptions' only refer to a type, but is being used as a value here.

even though it is imported with FileTransfer.