guansss / pixi-live2d-display

A PixiJS plugin to display Live2D models of any kind.
https://guansss.github.io/pixi-live2d-display/
MIT License
823 stars 125 forks source link

error TS2503: Cannot find namespace 'CubismSpec' #70

Closed BenchWidth closed 2 years ago

BenchWidth commented 2 years ago

拉取项目后按照开放文档,进行了项目配置。 我使用执行build 构建的时候一切正常,成功构建了js文件。

但当我执行type指令的时候报错 cubism/src/effect/cubismpose.d.ts(19,30): error TS2503: Cannot find namespace 'CubismSpec'. cubism/src/live2dcubismframework.d.ts(74,18): error TS2503: Cannot find namespace 'Live2DCubismCore'. cubism/src/model/cubismmodel.d.ts(33,17): error TS2503: Cannot find namespace 'Live2DCubismCore'. cubism/src/model/cubismmodel.d.ts(322,24): error TS2503: Cannot find namespace 'Live2DCubismCore'. cubism/src/model/cubismmodeluserdata.d.ts(30,25): error TS2503: Cannot find namespace 'CubismSpec'. cubism/src/model/cubismmodeluserdata.d.ts(43,25): error TS2503: Cannot find namespace 'CubismSpec'. 几乎所有的命名空间都找不到。

我只是想尝试一下,生成一个声明文件。

guansss commented 2 years ago

我自己 clone 下来试了一下没有问题

你拉取的项目是最新的 0.4.0-beta 吗,还是 0.3.x,如果是旧版本的话就会出现这种情况

BenchWidth commented 2 years ago

我自己克隆下来试一下没有问题

你拉取的旧项目是最新出现的 0.4.0-beta 吗,还是 0.3.x,如果是版本的话会出现这种情况

我使用的0.3.1,既然是有问题的话,那么在npm拉取的时候types/index.d.ts是如何生成的呢?

guansss commented 2 years ago

文档里没有写,旧版里要打一个补丁,就是手动把这段代码复制到 node_modules/dts-bundle-generator/dist/compile-dts.jsgetDeclarationFiles() 函数的末尾,并且在每次 yarn install/add/remove 等会改变 node_modules 里内容的操作之后都要再复制一遍

在 0.4.0 之后就改为自动补丁了,不需要再手动操作

BenchWidth commented 2 years ago

文档里没有写,旧版里要打一个补丁,就是手动把这段代码复制到 node_modules/dts-bundle-generator/dist/compile-dts.jsgetDeclarationFiles() 函数的末尾,并且在每次 yarn install/add/remove 等会改变 node_modules 里内容的操作之后都要再复制一遍

在 0.4.0 之后就改为自动补丁了,不需要再手动操作

明白了,谢谢啦