javascript 错误WEBPACK_IMPORTED_MODULE_0___default(...)不是函数

ghg1uchk  于 2023-01-08  发布在  Java
关注(0)|答案(1)|浏览(895)

当我尝试import the JS SDK Veriff时,我得到了以下错误。我如何解决这个错误?
类型错误:默认值(...)不是函数

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) => {

      }
    });

我还尝试将以下内容添加到我的tsconfig.json中。

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

gudnpqoy1#

您需要将导入更改为:

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

(摘自https://github.com/Veriff/veriff-js-sdk#install-js-sdk上的文档)

相关问题