首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >未捕获TypeError:...不是构造函数类型脚本模块导入错误

未捕获TypeError:...不是构造函数类型脚本模块导入错误
EN

Stack Overflow用户
提问于 2021-11-10 13:13:00
回答 1查看 63关注 0票数 0

我有一个示例typscript项目,它是我从github克隆的,并随npm install一起安装。

在index.ts中,我正在尝试导入第三方模块(https://github.com/ScatterCo/Depthkit.js)。此模块已使用npm install depthkit下载到node_modules文件夹中

为了导入模块,我尝试了import {DepthKit} from 'depthkit/build/depthkit';import * as DK from 'depthkit/build/depthkit';

但是当我运行var depthkit = new DepthKit();var depthkit = new DK.DepthKit();时,我得到了一个错误的Uncaught TypeError: depthkit_1.DepthKit is not a constructor

我该怎么解决这个问题?

EN

Stack Overflow用户

发布于 2021-11-10 18:22:30

根据我读到的代码,正确的导入应该是import DepthKit from "depthkit",因为DepthKit类是索引默认导出

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69913899

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档