visualstudio调试html,debugging - How do I debug HTML and JavaScript together in VSCode (Visual Studio ...

I have a really simple project in VSCode, an index.html file linking to a single app.js file.

I want to run and debug this mini website when I hit F5.

How do I configure VSCode to open index.html in the browser and then allow me to set breakpoints in app.js that will be triggered by my interaction with the app in the browser?

In Visual Studio this would "just work", because it fires up its own web server, IIS Express. In VSCode I'm not sure how I set up launch.json and/or tasks.json to create a simple node.js web server and serve index.html.

I have seen some examples of debugging javascript apps, for example this launch.json:

{

"version": "0.1.0",

"configurations": [

{

"name": "Launch Bjarte's app",

"type": "node",

"program": "app.js",

"stopOnEntry": true,

"args": [],

"cwd": ".",

"runtimeExecutable": null,

"runtimeArguments": [],

"env": {},

"sourceMaps": false

},

{

"name": "Attach",

"type": "node",

"address": "localhost",

"port": 5858,

"sourceMaps": false

}

]

}

This will run the js file, but I don't understand how I can interact with the app.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值