Angular 角度源贴图已损坏

Angular 角度源贴图已损坏,angular,angular-cli,Angular,Angular Cli,我只是将angular项目更新为angular版本12,由于某些原因,sourcemap停止工作,现在在控制台上出现错误时无法调试。这是我的tsconfig和angular.js: tsconfig.json { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir&qu

我只是将angular项目更新为angular版本12,由于某些原因,sourcemap停止工作,现在在控制台上出现错误时无法调试。这是我的tsconfig和angular.js:

tsconfig.json

{
    "compileOnSave": false,
    "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "noImplicitAny": false,
        "downlevelIteration": true,
        "experimentalDecorators": true,
        "module": "es2020",
        "moduleResolution": "node",
        "importHelpers": true,
        "target": "ES2015",
        "strict": true,
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "strictNullChecks": false,
        "noImplicitReturns": true,
        "noUnusedLocals": true,
        "types": ["node", "jest", "cypress"],
        "typeRoots": ["node_modules/@types"],
        "lib": ["es2018", "es2019", "dom"],
        "paths": {
            "@models/*": ["src/app/models/*"],
            "@services/*": ["src/app/services/*"],
            "@store/*": ["src/app/store/*"],
            "@functions/*": ["src/app/functions/*"],
            "@shared/*": ["src/app/shared/*"]
        }
    },
    "angularCompilerOptions": {
        "fullTemplateTypeCheck": true,
        "strictInjectionParameters": true,
        "strictInputAccessModifiers": true
    },
    "exclude": ["e2e/**/.*ts"]
}
{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "cli": {
        "defaultCollection": "@ngrx/schematics",
        "analytics": false
    },
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
        "ms-mr-ui": {
            "projectType": "application",
            "schematics": {
                "@schematics/angular:component": {
                    "style": "scss",
                    "skipTests": true
                },
                "@ngrx/schematics:component": {
                    "style": "scss",
                    "changeDetection": "OnPush"
                },
                "@ngrx/schematics:directive": {},
                "@ngrx/schematics:pipe": {},
                "@ngrx/schematics:service": {},
                "@ngrx/schematics:module": {
                    "commonModule": false
                },
                "@ngrx/schematics:class": {
                    "skipTests": true
                },
                "@ngrx/schematics:store": {
                    "statePath": "store",
                    "stateInterface": "State"
                },
                "@ngrx/schematics:action": {
                    "creators": true,
                    "flat": false,
                    "api": true
                },
                "@ngrx/schematics:reducer": {
                    "creators": true,
                    "flat": false,
                    "api": true,
                    "spec": true
                },
                "@ngrx/schematics:effect": {
                    "creators": false,
                    "flat": false,
                    "api": true,
                    "spec": true
                },
                "@ngrx/schematics:entity": {
                    "creators": false,
                    "flat": false,
                    "spec": true
                },
                "@ngrx/schematics:feature": {
                    "creators": true,
                    "flat": false,
                    "api": true,
                    "spec": true
                },
                "@ngrx/schematics:container": {
                    "style": "scss",
                    "changeDetection": "OnPush",
                    "testDepth": "unit",
                    "skipTests": true
                }
            },
            "root": "",
            "sourceRoot": "src",
            "prefix": "mr",
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "outputPath": "dist/ms-mr-ui",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "tsconfig.app.json",
                        "aot": true,
                        "assets": ["src/favicon.ico", "src/assets"],
                        "styles": [
                            "src/styles/styles.scss",
                            "node_modules/@aposin/ng-aquila/css/utilities.css",
                            "node_modules/@allianz/ngx-ndbx/css/ndbx-base.css",
                            "node_modules/@allianz/ngx-ndbx/css/themes/ndbx.css"
                        ],
                        "scripts": []
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                }
                            ],
                            "optimization": true,
                            "outputHashing": "all",
                            "sourceMap": false,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "budgets": [
                                {
                                    "type": "initial",
                                    "maximumWarning": "2mb",
                                    "maximumError": "5mb"
                                },
                                {
                                    "type": "anyComponentStyle",
                                    "maximumWarning": "6kb",
                                    "maximumError": "10kb"
                                }
                            ]
                        },
                        "development": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.dev.ts"
                                }
                            ],
                            "optimization": true,
                            "outputHashing": "all",
                            "sourceMap": false,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "budgets": [
                                {
                                    "type": "initial",
                                    "maximumWarning": "2mb",
                                    "maximumError": "5mb"
                                },
                                {
                                    "type": "anyComponentStyle",
                                    "maximumWarning": "6kb",
                                    "maximumError": "10kb"
                                }
                            ]
                        },
                        "es5": {
                            "tsConfig": "tsconfigs/tsconfig.es5.json"
                        }
                    }
                },
                "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"],
                        "styles": [
                            "src/styles/scss/styles.scss",
                            "src/styles/fonts/IBMPlex/ibmplex.css",
                            "src/styles/fonts/inter-web-hinted/inter.css",
                            "node_modules/material-icons/iconfont/material-icons.css"
                        ],
                        "scripts": [],
                        "stylePreprocessorOptions": {
                            "includePaths": ["src/styles/scss"]
                        },
                        "codeCoverageExclude": [
                            "/**/*mock*.ts",
                            "/**/*validators.ts",
                            "/**/*module.ts",
                            "/**/*api.service.ts",
                            "/**/models/**",
                            "/**/constants/**"
                        ]
                    }
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "options": {
                        "browserTarget": "ms-mr-ui:build"
                    },
                    "configurations": {
                        "production": {
                            "browserTarget": "ms-mr-ui:build:production"
                        },
                        "development": {
                            "browserTarget": "ms-mr-ui:build:development"
                        },
                        "es5": {
                            "browserTarget": "ms-mr-ui:build:es5"
                        }
                    }
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                        "browserTarget": "ms-mr-ui:build"
                    }
                },
                "lint": {
                    "builder": "@angular-devkit/build-angular:tslint",
                    "options": {
                        "tsConfig": ["tsconfig.app.json", "tsconfigs/tsconfig.spec.json", "tsconfigs/tsconfig.e2e.json"],
                        "exclude": ["**/node_modules/**"]
                    }
                }
            }
        }
    },
    "defaultProject": "ms-mr-ui"
angular.json

{
    "compileOnSave": false,
    "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "noImplicitAny": false,
        "downlevelIteration": true,
        "experimentalDecorators": true,
        "module": "es2020",
        "moduleResolution": "node",
        "importHelpers": true,
        "target": "ES2015",
        "strict": true,
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "strictNullChecks": false,
        "noImplicitReturns": true,
        "noUnusedLocals": true,
        "types": ["node", "jest", "cypress"],
        "typeRoots": ["node_modules/@types"],
        "lib": ["es2018", "es2019", "dom"],
        "paths": {
            "@models/*": ["src/app/models/*"],
            "@services/*": ["src/app/services/*"],
            "@store/*": ["src/app/store/*"],
            "@functions/*": ["src/app/functions/*"],
            "@shared/*": ["src/app/shared/*"]
        }
    },
    "angularCompilerOptions": {
        "fullTemplateTypeCheck": true,
        "strictInjectionParameters": true,
        "strictInputAccessModifiers": true
    },
    "exclude": ["e2e/**/.*ts"]
}
{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "cli": {
        "defaultCollection": "@ngrx/schematics",
        "analytics": false
    },
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
        "ms-mr-ui": {
            "projectType": "application",
            "schematics": {
                "@schematics/angular:component": {
                    "style": "scss",
                    "skipTests": true
                },
                "@ngrx/schematics:component": {
                    "style": "scss",
                    "changeDetection": "OnPush"
                },
                "@ngrx/schematics:directive": {},
                "@ngrx/schematics:pipe": {},
                "@ngrx/schematics:service": {},
                "@ngrx/schematics:module": {
                    "commonModule": false
                },
                "@ngrx/schematics:class": {
                    "skipTests": true
                },
                "@ngrx/schematics:store": {
                    "statePath": "store",
                    "stateInterface": "State"
                },
                "@ngrx/schematics:action": {
                    "creators": true,
                    "flat": false,
                    "api": true
                },
                "@ngrx/schematics:reducer": {
                    "creators": true,
                    "flat": false,
                    "api": true,
                    "spec": true
                },
                "@ngrx/schematics:effect": {
                    "creators": false,
                    "flat": false,
                    "api": true,
                    "spec": true
                },
                "@ngrx/schematics:entity": {
                    "creators": false,
                    "flat": false,
                    "spec": true
                },
                "@ngrx/schematics:feature": {
                    "creators": true,
                    "flat": false,
                    "api": true,
                    "spec": true
                },
                "@ngrx/schematics:container": {
                    "style": "scss",
                    "changeDetection": "OnPush",
                    "testDepth": "unit",
                    "skipTests": true
                }
            },
            "root": "",
            "sourceRoot": "src",
            "prefix": "mr",
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "outputPath": "dist/ms-mr-ui",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "tsconfig.app.json",
                        "aot": true,
                        "assets": ["src/favicon.ico", "src/assets"],
                        "styles": [
                            "src/styles/styles.scss",
                            "node_modules/@aposin/ng-aquila/css/utilities.css",
                            "node_modules/@allianz/ngx-ndbx/css/ndbx-base.css",
                            "node_modules/@allianz/ngx-ndbx/css/themes/ndbx.css"
                        ],
                        "scripts": []
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                }
                            ],
                            "optimization": true,
                            "outputHashing": "all",
                            "sourceMap": false,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "budgets": [
                                {
                                    "type": "initial",
                                    "maximumWarning": "2mb",
                                    "maximumError": "5mb"
                                },
                                {
                                    "type": "anyComponentStyle",
                                    "maximumWarning": "6kb",
                                    "maximumError": "10kb"
                                }
                            ]
                        },
                        "development": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.dev.ts"
                                }
                            ],
                            "optimization": true,
                            "outputHashing": "all",
                            "sourceMap": false,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "budgets": [
                                {
                                    "type": "initial",
                                    "maximumWarning": "2mb",
                                    "maximumError": "5mb"
                                },
                                {
                                    "type": "anyComponentStyle",
                                    "maximumWarning": "6kb",
                                    "maximumError": "10kb"
                                }
                            ]
                        },
                        "es5": {
                            "tsConfig": "tsconfigs/tsconfig.es5.json"
                        }
                    }
                },
                "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"],
                        "styles": [
                            "src/styles/scss/styles.scss",
                            "src/styles/fonts/IBMPlex/ibmplex.css",
                            "src/styles/fonts/inter-web-hinted/inter.css",
                            "node_modules/material-icons/iconfont/material-icons.css"
                        ],
                        "scripts": [],
                        "stylePreprocessorOptions": {
                            "includePaths": ["src/styles/scss"]
                        },
                        "codeCoverageExclude": [
                            "/**/*mock*.ts",
                            "/**/*validators.ts",
                            "/**/*module.ts",
                            "/**/*api.service.ts",
                            "/**/models/**",
                            "/**/constants/**"
                        ]
                    }
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "options": {
                        "browserTarget": "ms-mr-ui:build"
                    },
                    "configurations": {
                        "production": {
                            "browserTarget": "ms-mr-ui:build:production"
                        },
                        "development": {
                            "browserTarget": "ms-mr-ui:build:development"
                        },
                        "es5": {
                            "browserTarget": "ms-mr-ui:build:es5"
                        }
                    }
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                        "browserTarget": "ms-mr-ui:build"
                    }
                },
                "lint": {
                    "builder": "@angular-devkit/build-angular:tslint",
                    "options": {
                        "tsConfig": ["tsconfig.app.json", "tsconfigs/tsconfig.spec.json", "tsconfigs/tsconfig.e2e.json"],
                        "exclude": ["**/node_modules/**"]
                    }
                }
            }
        }
    },
    "defaultProject": "ms-mr-ui"

}

我认为Angular 12可以在不使用sourcemaps的情况下为应用程序的生产版本提供服务

尝试:
ngserve--sourcemap
查看源映射。从这个角度看,似乎
--sourcemap
标志已被弃用,必须通过浏览器生成器来完成,我认为这是
angular.json
中的
配置中的

尝试添加:

 "serve": {
        ...
        "defaultConfiguration": "development"
  },
和变化:

  "architect": {
        "build": {
          "configurations": {
           ...
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true
            }