简体   繁体   English

WebStorm 断点在 Angular 8 和 9 升级后不会暂停

[英]WebStorm breakpoints not pausing after Angular 8 and 9 upgrade

The issue问题

We have an Angular 7.2 CLI multi-project app with shared libraries.我们有一个带有共享库的 Angular 7.2 CLI 多项目应用程序。 We upgraded to Angular 8 and then Angular 9. After the upgrade to Angular 8 WebStorm no longer pauses on breakpoints when debugging in the projects that consume shared libraries.我们升级到 Angular 8,然后是 Angular 9。升级到 Angular 8 后,WebStorm 在使用共享库的项目中调试时不再在断点处暂停。 The breakpoints in the library that has no dependencies on the other projects always pause as expected.库中不依赖其他项目的断点总是按预期暂停。

What we have tried so far到目前为止我们尝试过的

We re-did the upgrade many times one item at a time until we determined that the issue started when we upgrade @angular/core which also upgrades typescript.我们一次多次重新升级一项,直到我们确定问题是在升级 @angular/core 时开始的,同时升级了打字稿。 We then created a new multi-project app using the CLI from scratch following the Angular directions here: https://angular.io/guide/file-structure We setup two libraries.然后,我们按照此处的 Angular 说明从头开始使用 CLI 创建了一个新的多项目应用程序: https : //angular.io/guide/file-structure我们设置了两个库。 common and common-child.共同和共同的孩子。 We added a test in common-child that imports a util class from common.我们在 common-child 中添加了一个测试,它从 common 中导入一个 util 类。 The test in common will pause on breakpoints but the test in common-child will not. common 中的测试会在断点处暂停,但 common-child 中的测试不会。 We have uploaded this repo here: https://github.com/chef55555/debug-issue我们在这里上传了这个 repo: https : //github.com/chef55555/debug-issue

Our environment我们的环境

  • WebStorm 2020.2.1网络风暴 2020.2.1
  • Node 14.4.0 and 14.3.0节点 14.4.0 和 14.3.0
  • Windows 10 and CentOS 7.8.2003 Windows 10 和 CentOS 7.8.2003

Steps to reproduce重现步骤

  • Clone repo https://github.com/chef55555/debug-issue克隆 repo https://github.com/chef55555/debug-issue
  • Change directory into repo将目录更改为 repo
  • Run npm ci运行npm ci
  • Run npm run build运行npm run build
  • Open project in WebStorm在 WebStorm 中打开项目
  • Set a breakpoint in projects/common/src/lib/shared/shared.util.spec.ts or projects/common/src/lib/shared/shared.util.ts在 projects/common/src/lib/shared/shared.util.spec.ts 或 projects/common/src/lib/shared/shared.util.ts 中设置断点
  • Debug projects/common/src/lib/shared/shared.util.spec.ts in WebStorm在 WebStorm 中调试项目/common/src/lib/shared/shared.util.spec.ts
  • The breakpoint should pause and it does.断点应该暂停,它会暂停。
  • Stop Karma server (this seems to be a best practice before running tests from a different project)停止 Karma 服务器(这似乎是从不同项目运行测试之前的最佳实践)
  • Set a breakpoint in projects/common-child/src/lib/child.spec.ts在projects/common-child/src/lib/child.spec.ts中设置断点
  • Debug projects/common-child/src/lib/child.spec.ts in webstorm在 webstorm 中调试项目/common-child/src/lib/child.spec.ts
  • The breakpoint should pause but it does not.断点应该暂停,但它没有。

If I remove or comment out lines 1 and 5 in projects/common-child/src/lib/child.spec.ts, then the breakpoints will pause.如果我删除或注释掉 projects/common-child/src/lib/child.spec.ts 中的第 1 行和第 5 行,则断点将暂停。 Sometimes I have to restart the Karma server to get the breakpoint to pause after making this change.有时我必须重新启动 Karma 服务器才能在进行此更改后暂停断点。

There are two ways to import a shared library file, using direct import like有两种方法可以导入共享库文件,使用直接导入,如

import { SharedUtil } from '../../../common/src/lib/shared/shared.util';

or setting a "paths" entry in tsconfig and then referencing the compiled library like this或者在 tsconfig 中设置一个“路径”条目,然后像这样引用编译的库

import { SharedUtil } from 'common';

We have found that when we use the first import style, the breakpoints still pause, but when we use the second import style they do not.我们发现,当我们使用第一个导入样式时,断点仍然会暂停,但是当我们使用第二个导入样式时,它们不会暂停。 We use this way of importing shared libraries extensively in our real project.我们在实际项目中广泛使用这种导入共享库的方式。

Root cause根本原因

All of this leads us to believe that there is some issue in WebStorm with debugging projects that use local shared libraries on Angular 8 or later.所有这些都让我们相信 WebStorm 在调试使用 Angular 8 或更高版本上的本地共享库的项目时存在一些问题。

Any ideas?有任何想法吗?

该问题已在WEB-44080 上进行跟踪,请关注它(和链接的票证)以获取更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM