Chu*_*hux 6 visual-studio-code angular
我正在尝试使用VSC开发一个基本的angular2应用程序.代码是用TypeScript编写的.它是一个基本的todo应用程序,所有代码(.ts,js,.js.map)都在app /子文件夹中.
这是Run的launch.json配置:
{
"name": "Run",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/lite-server/bin/lite-server",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
},
Run Code Online (Sandbox Code Playgroud)
当我运行它时,应用程序加载chrome,但我的断点都不起作用.当我悬停一个断点时,我看到"断点被忽略,因为找不到生成的代码(源映射问题?)."
我在/app/todo.component.ts中有一个断点.在我的/app/todo.component.js.map中我可以看到:
"file":"todo.component.js","sourceRoot":"/Users/xxx/Documents/webs/angular2-todo/app/","sources":["todo.component.ts"],"names":[],"mappings":";;;;;;;;;;
Run Code Online (Sandbox Code Playgroud)
源根和来源对我来说似乎没问题.
有任何想法吗?
小智 16
你必须做:
例:
{
"name": "Launch Chrome against localhost, with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"userDataDir": "${workspaceRoot}/out/chrome"
}
Run Code Online (Sandbox Code Playgroud)
使用"npm start"(终端窗口或控制台)启动服务器.
启动调试(F5或在下拉列表中选择"针对localhost启动Chrome ...").
| 归档时间: |
|
| 查看次数: |
7511 次 |
| 最近记录: |