小编Chr*_*cht的帖子

在VS Code和Chrome中调试angular-cli TS

我有一个默认的Angular 4 cli项目.我已经设置了Visual Studio Code和Chrome扩展,以便能够调试它并在vendor.bundle.js文件中添加一些断点.

当我在该文件中设置断点时,我得到了注释Breakpoint ignored because generated code not found (source map problem?).源地图就在那里.

我一直在尝试所有可能的配置launch.json,但没有运气.

我在跟踪日志中看到以下内容:

SourceMap: creating for http://localhost:4200/vendor.bundle.js
SourceMap: sourceRoot: webpack:///
SourceMap: sources: ["C:/GIT/c24/apps/C24/c24-my-app/src/$_gendir/node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.ngfactory.ts", ...]
SourceMap: webRoot: c:\GIT\c24\apps\C24\c24-my-app
SourceMap: resolved sourceRoot webpack:/// -> c:\GIT\c24\apps\C24\c24-my-app\webpack:\
SourceMaps.scriptParsed: http://localhost:4200/vendor.bundle.js was just loaded and has mapped sources: ["c:\\GIT\\c24\\apps\\C24\\c24-my-app\\src\\$_gendir\\node_modules\\@ng-bootstrap\\ng-bootstrap\\alert\\alert.ngfactory.ts", ...]
Run Code Online (Sandbox Code Playgroud)

我的launch.json配置

{
    "version": "0.2.0",
    "protocol": "inspector",
    "configurations": [
        {
            "name": "Launch Chrome against localhost, with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceRoot}",
            "sourceMaps": true,
            "trace": true, …
Run Code Online (Sandbox Code Playgroud)

google-chrome typescript visual-studio-code angular

6
推荐指数
0
解决办法
370
查看次数