Home > database >  Error WEBPACK_IMPORTED_MODULE_0___default(...) is not a function
Error WEBPACK_IMPORTED_MODULE_0___default(...) is not a function

Time:01-06

I am getting the following error when I tried to import the JS SDK Veriff. How can I resolve this error ?

TypeError: _veriff_js_sdk__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function

import { Component, OnInit } from '@angular/core';
import Veriff from '@veriff/js-sdk';

@Component({
  selector: 'hp',
  templateUrl: './hp.component.html',
  styleUrls: ['./hp.component.css']
})
    export class HPComponent implements OnInit {

  constructor(  ) { }

  ngOnInit(): void {

    const v =  Veriff({
      host:'',
      apiKey:'',
      parentId:'',
      onSession: (err:any, res:any) => {

      }
    });

I have also tried adding the following to my tsconfig.json.

{
  "compileOnSave": false,
  "compilerOptions": {
    ...
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
  },
  "angularCompilerOptions": {
     "enableI18nLegacyMessageIdFormat": false,
     "strictInjectionParameters": true,
     "strictInputAccessModifiers": true,
     "strictTemplates": true
  }
}

CodePudding user response:

You need to change the import to:

import { Veriff } from '@veriff/js-sdk';

(taken from the documentation at https://github.com/Veriff/veriff-js-sdk#install-js-sdk)

  • Related