VSCode中Angular应用F5启动调试异常问题求助
VSCode中Angular应用F5启动调试异常问题求助
大家好,最近碰到个挺头疼的问题,想请教下有没有同行遇到过类似情况?
之前我们团队开发Angular应用时,一直是在VSCode里按F5就能顺畅完成整套调试流程:Angular应用会自动构建,Chrome浏览器随之启动,我们还能直接在VSCode里调试代码,完全没出过问题。
但最近几天这个流程突然失效了,以下是我们的配置文件:
launch.json 配置
{ "version": "0.2.0", "configurations": [ { "name": "Launch Chrome", "request": "launch", "type": "chrome", "preLaunchTask": "npm: start", "url": "http://localhost:4200", "webRoot": "${workspaceFolder}" } ] }
tasks.json 配置
{ "version": "2.0.0", "tasks": [ { "type": "npm", "script": "start", "isBackground": true, "problemMatcher": { "owner": "typescript", "pattern": "$tsc", "background": { "activeOnStart": true, "beginsPattern": { "regexp": "(.*?)" }, "endsPattern": { "regexp": "Compiled successfully." } } } } ] }
现在的异常情况是:按F5后,应用能正常构建(没有任何报错),Chrome也能正常启动,甚至能看到网页标题,但页面一直卡在加载状态,右键无法查看源码,浏览器的网络面板也看不到任何请求。
但有个很奇怪的点:终端最后输出的这条提示里的链接——** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **,我按住Ctrl点击它打开浏览器,应用就能完全正常运行,功能一点问题都没有。
关键是我们已经很久没改动过上面这两个配置文件了,所以想问问有没有其他开发者也遇到过这种VSCode按F5无法正常启动/调试的情况?
备注:内容来源于stack exchange,提问作者Josh
相关产品推荐
相关产品推荐

