vscode 使用JavsScript debugger 插件调试Vue+vite项目

vscode 使用JavsScript debugger 插件调试Vue+vite项目,JavsScript debugger 插件是vscode自带的,我用的vscode 版本Version: 1.88.1

插件有了,试着点击vscode 运行和调试按钮

选择Web App(Chrome)

出现Launch Chrome against 点击运行

启动了Chrome,项目启动失败,因为端口改为了8080 并且自动生成了launch.json文件

需要先启动项目 npm run dev 或者yarn dev, 把launch.json端口改成项目的端口,关掉先前调试的浏览器窗口,重新开始运行调试。

kotlin 复制代码
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome against localhost",
      "url": "http://localhost:5173", // 换成项目的端口
      "webRoot": "${workspaceFolder}"
    }
  ]
}

进入断点了,但是另一个文件断点却是没生效,unbound,因为项目还没执行到没生效的那个文件,执行到这个文件,就生效了,如下图

也可以新建js debug terminal 运行项目打开调试断点


想要在vite.config.ts打断点,需要新建js debug terminal,运行项目,断点自动执行

相关推荐
free-elcmacom4 天前
发际线警告!手撕《C陷阱与缺陷》终极 BOSS:signal 函数与 typedef 魔法
c语言·开发语言·visual studio code·visual studio
前端小白乘风4 天前
VS Code 终于能连微信了!发现一个硬核开源神仙插件:WeChat AHP
微信·visual studio code·deepseek
free-elcmacom6 天前
C语言指针进阶——指针数组模拟二维数组,以及二级指针到底怎么理解
c语言·visual studio code
formulahendry6 天前
微信和 VS Code 强强联合!WeChat AHP 来了
visual studio code·vs code
Z_Quintaz7 天前
关于导航栏颜色透明这件事
前端·debug
向北丶8 天前
vscode 导入语句排序和删除未使用的导入
前端·visual studio code
InsightCore11 天前
别再往 Skill 里塞一切:我们如何重新思考 AI Debug Engineer
android·debug
Eric_见嘉12 天前
打开这个 VSC 设置「组件引用位置」和数量就都清楚了
前端·typescript·visual studio code
Flynt19 天前
Chrome 修了个零日漏洞,你的 VS Code 和 Cursor 可能还在裸奔
安全·electron·visual studio code
zhuodedao22 天前
Spring AI + MCP 文件工具未调用问题复盘:为什么初始化成功却没有写入文件?
java·debug·agent·springai·mcp