捆绑到 UMD 错误无法从 dist\fesm5\my-api-name.js 解析 'my-service'
Bundling to UMD error could not resolve 'my-service' from dist\fesm5\my-api-name.js
自本周结束以来,来自 swagger 打开的 angular 8.2.7 打字稿的客户端代码生成-api 3 spec 文件停止工作:
------------------------------------------------------------------------------
Building entry point '@my-company/my-api'
------------------------------------------------------------------------------
Compiling TypeScript sources through ngc
Bundling to FESM2015
WARNING: 'HttpResponse', 'HttpEvent' and 'HttpParameterCodec' are imported from external module '@angular/common/http' but never used
Bundling to FESM5
WARNING: 'HttpResponse', 'HttpEvent' and 'HttpParameterCodec' are imported from external module '@angular/common/http' but never used
Bundling to UMD
ERROR: Could not resolve './my.service' from dist\fesm5\my-generated-api-name.js
我试图恢复到以前版本的“@openapitools/openapi-generator-cli”:“0.0.19-4.1.2”到版本“0.0.19-4.1.1”
我还在 https://petstore.swagger.io/ 尝试了一个虚拟的 open-api 3 spec 测试文件,但我得到了同样的错误
调试日志什么也没说我很无能
这里是 npm 命令我 运行:
"generate-front": "openapi-generator generate -i http://localhost:22953/swagger/v1/swagger.json -g typescript-angular -o ./code-front -c options-front.json"
这是选项文件:
{
"npmName": "@my-company/my-api",
"npmVersion": "0.18.0",
"ngVersion": "8.2.7",
"serviceSuffix": "Repository",
"modelSuffix": "Model"
}
构建应该没有错误
问题出在 ng-packagr 上,它安装了具有重大更改的最新版本
"ng-packagr": "^5.4.0"
我摘下帽子,一切正常:
"ng-packagr": "5.4.0"
瞧!
------------------------------------------------------------------------------
Building entry point '@my-company/my-api'
------------------------------------------------------------------------------
Compiling TypeScript sources through ngc
Bundling to FESM2015
Bundling to FESM5
Bundling to UMD
Minifying UMD bundle
Copying declaration files
Writing package metadata
Removing scripts section in package.json as it's considered a potential security vulnerability.
Built @my-company/my-api
------------------------------------------------------------------------------
Built Angular Package!
- from: D:\my-dev-repo\openapi-codegen\code-front
- to: D:\my-dev-repo\openapi-codegen\code-front\dist
------------------------------------------------------------------------------
自本周结束以来,来自 swagger 打开的 angular 8.2.7 打字稿的客户端代码生成-api 3 spec 文件停止工作:
------------------------------------------------------------------------------
Building entry point '@my-company/my-api'
------------------------------------------------------------------------------
Compiling TypeScript sources through ngc
Bundling to FESM2015
WARNING: 'HttpResponse', 'HttpEvent' and 'HttpParameterCodec' are imported from external module '@angular/common/http' but never used
Bundling to FESM5
WARNING: 'HttpResponse', 'HttpEvent' and 'HttpParameterCodec' are imported from external module '@angular/common/http' but never used
Bundling to UMD
ERROR: Could not resolve './my.service' from dist\fesm5\my-generated-api-name.js
我试图恢复到以前版本的“@openapitools/openapi-generator-cli”:“0.0.19-4.1.2”到版本“0.0.19-4.1.1”
我还在 https://petstore.swagger.io/ 尝试了一个虚拟的 open-api 3 spec 测试文件,但我得到了同样的错误
调试日志什么也没说我很无能
这里是 npm 命令我 运行:
"generate-front": "openapi-generator generate -i http://localhost:22953/swagger/v1/swagger.json -g typescript-angular -o ./code-front -c options-front.json"
这是选项文件:
{
"npmName": "@my-company/my-api",
"npmVersion": "0.18.0",
"ngVersion": "8.2.7",
"serviceSuffix": "Repository",
"modelSuffix": "Model"
}
构建应该没有错误
问题出在 ng-packagr 上,它安装了具有重大更改的最新版本
"ng-packagr": "^5.4.0"
我摘下帽子,一切正常:
"ng-packagr": "5.4.0"
瞧!
------------------------------------------------------------------------------
Building entry point '@my-company/my-api'
------------------------------------------------------------------------------
Compiling TypeScript sources through ngc
Bundling to FESM2015
Bundling to FESM5
Bundling to UMD
Minifying UMD bundle
Copying declaration files
Writing package metadata
Removing scripts section in package.json as it's considered a potential security vulnerability.
Built @my-company/my-api
------------------------------------------------------------------------------
Built Angular Package!
- from: D:\my-dev-repo\openapi-codegen\code-front
- to: D:\my-dev-repo\openapi-codegen\code-front\dist
------------------------------------------------------------------------------