英文:
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论