我将 Angular 项目从 Angular 10 更新到 11x。一切正常,除了一个使用 ng serve
运行项目的警告。 (在 ng serve 中没有任何选项)。警告是:
Option "sourceMap" is deprecated: Use the "sourceMap" option in the browser builder instead.
警告未出现在
ng build
中.以下是浏览器构建器在
angular.json
中的组成部分该项目的外观如下:"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/my-app",
"index": "src/index.html",
"sourceMap": true,
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
Angular 11 中的某些相关内容发生了变化?如何消除此警告?
最佳答案
我对一些答案感到困惑,这些选项并没有真正被弃用,但现在应该在 angular.json 的正确“构建”部分中指定,而不是“服务”。
关于Angular 11 - ng serve - 不推荐使用选项 "sourceMap",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66919289/