VSCode 未绑定断点

VSCode Unbound breakpoint

我尝试了所有这些解决方案 但都失败了。 我还能尝试什么。我只想逐行调试我的代码。

我的项目

├── .vscode

│ ├── extensions.json

│ ├── launch.json

│ └── settings.json

├── 源码

│ ├── 应用

│ ├── 资产

│ ├── 环境

│ └── 款式

└── angular.json

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome against localhost",
      "url": "http://localhost:4200",
      "webRoot": "${workspaceRoot}",
      "sourceMaps": true
    }
  ]
}

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "cli": {
    "analytics": false
  },
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "myproject": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "spec": false,
          "flat": false,
          "inlineStyle": true,
          "inlineTemplate": false,
          "style": "less"
        },
        "@schematics/angular:application": {
          "strict": true
        },
        "ng-alain:module": {
          "routing": true,
          "spec": false
        },
        "ng-alain:list": {
          "spec": false
        },
        "ng-alain:edit": {
          "spec": false,
          "modal": true
        },
        "ng-alain:view": {
          "spec": false,
          "modal": true
        },
        "ng-alain:curd": {
          "spec": false
        },
        "@schematics/angular:module": {
          "routing": true,
          "spec": false
        },
        "@schematics/angular:directive": {
          "spec": false
        },
        "@schematics/angular:service": {
          "spec": false
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/myproject",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.json",
              {
                "glob": "**/*",
                "input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
                "output": "/assets/"
              }
            ],
            "styles": [
              "node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
              "src/styles.less"
            ],
            "scripts": [],
            "allowedCommonJsDependencies": [
              "@antv/g2",
              "ajv",
              "ajv-formats",
              "date-fns",
              "file-saver"
            ]
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all",
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "3mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            },
            "qas": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.qas.ts"
                }
              ],
              "outputHashing": "all",
              "namedChunks": false,
              "vendorChunk": false,
              "buildOptimizer": true,
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "myproject:build",
            "proxyConfig": "proxy/proxy.conf.json",
            "disableHostCheck": true,
            "host": "0.0.0.0",
            "port": 4290,
            "open": true
          },
          "configurations": {
            "production": {
              "browserTarget": "myproject:build:production"
            },
            "qas": {
              "browserTarget": "myproject:build:qas"
            },
            "development": {
              "browserTarget": "myproject:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "myproject:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.json"
            ],
            "styles": [
              "src/styles.less"
            ],
            "scripts": []
          }
        },
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "myproject:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "myproject:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "myproject"
}

我明白了!我将以下代码添加到我的 angular.json 文件中。

"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "cli": {
    "analytics": false
  },
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "myproject": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "spec": false,
          "flat": false,
          "inlineStyle": true,
          "inlineTemplate": false,
          "style": "less"
        },
        "@schematics/angular:application": {
          "strict": true
        },
        "ng-alain:module": {
          "routing": true,
          "spec": false
        },
        "ng-alain:list": {
          "spec": false
        },
        "ng-alain:edit": {
          "spec": false,
          "modal": true
        },
        "ng-alain:view": {
          "spec": false,
          "modal": true
        },
        "ng-alain:curd": {
          "spec": false
        },
        "@schematics/angular:module": {
          "routing": true,
          "spec": false
        },
        "@schematics/angular:directive": {
          "spec": false
        },
        "@schematics/angular:service": {
          "spec": false
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/myproject",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.json",
              {
                "glob": "**/*",
                "input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
                "output": "/assets/"
              }
            ],
            "styles": [
              "node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
              "src/styles.less"
            ],
            "scripts": [],
            "allowedCommonJsDependencies": [
              "@antv/g2",
              "ajv",
              "ajv-formats",
              "date-fns",
              "file-saver"
            ],
            "vendorChunk": true,
            "extractLicenses": false,
            "buildOptimizer": false,
            "sourceMap": true,
            "optimization": false,
            "namedChunks": true
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all",
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "3mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            },
            "qas": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.qas.ts"
                }
              ],
              "outputHashing": "all",
              "namedChunks": false,
              "vendorChunk": false,
              "buildOptimizer": true,
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "myproject:build",
            "proxyConfig": "proxy/proxy.conf.json",
            "disableHostCheck": true,
            "host": "0.0.0.0",
            "port": 4290,
            "open": true
          },
          "configurations": {
            "production": {
              "browserTarget": "myproject:build:production"
            },
            "qas": {
              "browserTarget": "myproject:build:qas"
            },
            "development": {
              "browserTarget": "myproject:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "myproject:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.json"
            ],
            "styles": [
              "src/styles.less"
            ],
            "scripts": []
          }
        },
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "myproject:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "myproject:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "myproject"
}