使用 WebStorm 的 Vue.js TypeScript 项目的调试器不会在断点处停止

Debbuger of Vue.js TypeScript project with WebStorm doesn't stop at break point

我使用带有 TypeScript 设置的 WebStorm 创建了新项目。然后,调试器断点不起作用。

我的设置

版本

项目设置

  1. 通天塔
  2. TypeScript
  3. 路由器
  4. CSS 预处理器
  5. 单元测试

构建设置

  1. Class 样式语法 => 是
  2. 在 Typescript 旁边使用 Babel => 是
  3. 使用 historymode => 否
  4. Css 预处理器:Sass/Scss dart-sass

代码

调试点在console.log("started")

<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import HelloWorld from './components/HelloWorld.vue';

console.log("satarted")

@Component({
  components: {
    HelloWorld,
},
})
export default class App extends Vue {}
</script>

<style lang="scss">
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

WebStorm 的调试设置:

然后我点击调试按钮,但它没有在断点处停止。

package.json, tsconfig.json等文件为默认设置。

如果你的程序没有在断点处停止,这通常意味着你的程序没有执行你的断点所在的代码。或者你看错了地方。在前端应用程序中,可以通过按 f12 在浏览器中查看控制台。我还建议使用 Vue Devtools 扩展,它非常有用。

您应该通过 运行ning(不是调试)npm serve 运行 配置启动您的应用程序,然后选择 JavaScript debug 配置并按 Debug.

请参阅https://blog.jetbrains.com/webstorm/2018/01/working-with-vue-js-in-webstorm/调试应用程序部分