Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
您好,我使用
egg-swagger-doc
,版本2.3.2
问题是这样的。
我使用
eggjs
的typescript
模板开发项目,安装了egg-swagger-doc
插件,npm run start
报错,错误原因部分提示如下:然后我找到了异常代码:
异常的原因是,我的
tsconfig.json
文件声明了"declaration":true
,在使用tsc
命令编译app/contract
目录下的ts
文件时会生成.js
文件和.d.ts
声明文件。您的代码中会把匹配
.ts
后缀的.d.ts
文件作为模块使用require('.d')
加载,而这个文件并不存在,所以报错。解决方法是跳过
.d.ts
类型的声明文件。这是我的修复代码。
请尽快修复,祝好。