Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度7,预算中的警告,超出最大值,未';我不明白怎么了?_Angular_Webpack_Bundle_Angular7 - Fatal编程技术网

Angular 角度7,预算中的警告,超出最大值,未';我不明白怎么了?

Angular 角度7,预算中的警告,超出最大值,未';我不明白怎么了?,angular,webpack,bundle,angular7,Angular,Webpack,Bundle,Angular7,我有一个角度7应用程序 当我使用--prod构建项目时,我在预算中有一个警告 angular.json "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/tbc-capital-web", "index": "src/index.html", "m

我有一个角度7应用程序

当我使用--prod构建项目时,我在预算中有一个警告

angular.json

"architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/tbc-capital-web",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "src/tsconfig.app.json",
        "assets": [
          "src/favicon.ico",
          "src/assets",
          "src/env.js",
          "src/web.config"
        ],
        "styles": [
          "src/styles.scss"
        ],
        "scripts": [],
        "es5BrowserSupport": true
      },
      "configurations": {
        "production": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": true,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "2mb",
              "maximumError": "5mb"
            }
          ]
        }
      }
    },
生成输出映像:

问题是我不明白这里出了什么问题

没有一个文件超过2mb

问题1:生成的一个或多个文件触发此警告

问题2:在
angular.json

"architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/tbc-capital-web",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "src/tsconfig.app.json",
        "assets": [
          "src/favicon.ico",
          "src/assets",
          "src/env.js",
          "src/web.config"
        ],
        "styles": [
          "src/styles.scss"
        ],
        "scripts": [],
        "es5BrowserSupport": true
      },
      "configurations": {
        "production": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": true,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "2mb",
              "maximumError": "5mb"
            }
          ]
        }
      }
    },
如果您不仅提供答案,而且提供一些解释,那就太好了。

预算是什么意思? 绩效预算是对特定值的一组限制,这些值 影响现场性能,这在设计和施工中可能不会超过 任何网络项目的开发

在我们的案例中,预算是捆绑大小的限制

另见:


为了简单起见,预算可以定义为目标构建大小,而不是在构建应用程序时克服

它可以用于托管,例如,在:当你在这样的服务上托管时,你有一个有限的免费服务,所以你不想克服它,这样你就不必付费

预算是所有文件的总大小,而不是最大文件的大小

大多数情况下,您可以忽略这一点,这实际上是一个部署问题:只是CLI默认包含此预算

要删除它,您可以进入
angular.json
包并找到以下内容:

          "budgets": [{
            "type": "initial",
            "maximumWarning": "2mb",
            "maximumError": "5mb"
          }]
只要更改值,它就不会再次弹出警告