angular.json 是Angular CLI的配置文件

    1. {
    2. "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    3. "version": 1,
    4. "newProjectRoot": "projects",
    5. "projects": {
    6. "angular-ivy-demo": {
    7. "projectType": "application",
    8. "schematics": {
    9. "@schematics/angular:component": {
    10. "style": "scss"
    11. }
    12. },
    13. "root": "",
    14. "sourceRoot": "src",
    15. "prefix": "app",
    16. "architect": {
    17. "build": {
    18. "builder": "@angular-devkit/build-angular:browser",
    19. "options": {
    20. "outputPath": "dist/angular-ivy-demo",
    21. "index": "src/index.html",
    22. "main": "src/main.ts",
    23. "polyfills": "src/polyfills.ts",
    24. "tsConfig": "tsconfig.app.json",
    25. "aot": true,
    26. "assets": [
    27. // assets下配置的文件,编译时会直接复制到outputPath下面
    28. "src/favicon.ico",
    29. "src/assets"
    30. ],
    31. "styles": [
    32. // styles下面的样式文件,编译时会编译到style.css,并输出到outputPath下面
    33. // 如果引用第三方的组件需要样式,可以在此处直接将组件的样式文件引入即可
    34. "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
    35. "src/styles.scss"
    36. ],
    37. "scripts": []
    38. },
    39. "configurations": {
    40. // configurations下面可以配置多个properties
    41. // "production""test"等,
    42. // 从而实现不同的环境使用不用的enviroment
    43. "production": {
    44. "fileReplacements": [
    45. {
    46. "replace": "src/environments/environment.ts",
    47. "with": "src/environments/environment.prod.ts"
    48. }
    49. ],
    50. "optimization": true,
    51. "outputHashing": "all",
    52. "sourceMap": false,
    53. "extractCss": true,
    54. "namedChunks": false,
    55. "aot": true,
    56. "extractLicenses": true,
    57. "vendorChunk": false,
    58. "buildOptimizer": true,
    59. "budgets": [
    60. {
    61. "type": "initial",
    62. "maximumWarning": "2mb",
    63. "maximumError": "5mb"
    64. }
    65. ]
    66. }
    67. }
    68. },
    69. "serve": {
    70. "builder": "@angular-devkit/build-angular:dev-server",
    71. "options": {
    72. "browserTarget": "angular-ivy-demo:build"
    73. },
    74. "configurations": {
    75. "production": {
    76. "browserTarget": "angular-ivy-demo:build:production"
    77. }
    78. }
    79. },
    80. "extract-i18n": {
    81. "builder": "@angular-devkit/build-angular:extract-i18n",
    82. "options": {
    83. "browserTarget": "angular-ivy-demo:build"
    84. }
    85. },
    86. "test": {
    87. "builder": "@angular-devkit/build-angular:karma",
    88. "options": {
    89. "main": "src/test.ts",
    90. "polyfills": "src/polyfills.ts",
    91. "tsConfig": "tsconfig.spec.json",
    92. "karmaConfig": "karma.conf.js",
    93. "assets": [
    94. "src/favicon.ico",
    95. "src/assets"
    96. ],
    97. "styles": [
    98. "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
    99. "src/styles.scss"
    100. ],
    101. "scripts": []
    102. }
    103. },
    104. "lint": {
    105. "builder": "@angular-devkit/build-angular:tslint",
    106. "options": {
    107. "tsConfig": [
    108. "tsconfig.app.json",
    109. "tsconfig.spec.json",
    110. "e2e/tsconfig.json"
    111. ],
    112. "exclude": [
    113. "**/node_modules/**"
    114. ]
    115. }
    116. },
    117. "e2e": {
    118. "builder": "@angular-devkit/build-angular:protractor",
    119. "options": {
    120. "protractorConfig": "e2e/protractor.conf.js",
    121. "devServerTarget": "angular-ivy-demo:serve"
    122. },
    123. "configurations": {
    124. "production": {
    125. "devServerTarget": "angular-ivy-demo:serve:production"
    126. }
    127. }
    128. }
    129. }
    130. }
    131. },
    132. "defaultProject": "angular-ivy-demo" // 默认项目,ng build默认执行的project
    133. }