【发布时间】:2020-03-28 19:54:07
【问题描述】:
我正在使用 Angular 7,我想将 Three JS 添加到我的项目中。但是在将其导入组件控制器后出现错误。我确实安装了npm install three --save 和它们的类型npm install @type/webgl2。它在我的终端 VS 代码中显示错误,并且代码也不起作用。我不太确定我是否正确,但我导入的是import * as THREE from 'three';。我一直在 Stackblitz 上关注一个 document,它可以工作,但仍然有错误显示让我无法构建我的项目。有什么办法可以摆脱这些错误?
这是我的错误的样子:
ERROR in node_modules/three/src/core/BufferAttribute.d.ts(21,6): error
TS1086: An accessor cannot be declared in an ambient context.
node_modules/three/src/core/InterleavedBufferAttribute.d.ts(19,6): error
TS1086: An accessor cannot be declared in an ambient context.
node_modules/three/src/core/InterleavedBufferAttribute.d.ts(20,6): error
TS1086: An accessor cannot be declared in an ambient context.
【问题讨论】:
-
您能发布您收到的确切错误消息吗?
-
是的,我已经更新了我的问题。
-
也许这会有所帮助 - stackoverflow.com/questions/58802463/…
-
你能接受答案吗?
标签: angular typescript three.js babeljs