错误:WEBPACK_IMPORTED_MODULE_0___default(…) 不是一个函数。

huangapple go评论121阅读模式
英文:

Error WEBPACK_IMPORTED_MODULE_0___default(...) is not a function

问题

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
}
}

英文:

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
  }
}

答案1

得分: 1

你需要将导入更改为:

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

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

英文:

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)

huangapple
  • 本文由 发表于 2023年1月6日 11:57:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75026786.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定