gpt4 book ai didi

angular - ng build --prod index.html 文件没有生成后?

转载 作者:行者123 更新时间:2023-12-04 13:58:00 32 4
gpt4 key购买 nike

在生产模式下构建项目后,我将 angular 7 更新为 8.2.1,但 dist 文件夹不会生成 index.html文件

tsconfig.json

{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"paths": {
"exceljs": [
"node_modules/exceljs/dist/exceljs.min"
]
},
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],

}
}

Dist/AssetMang/
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"AssetMang": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/AssetMang",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "5mb",
"maximumError": "8mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"port": 4204,
"browserTarget": "AssetMang:build"
},
"configurations": {
"production": {
"browserTarget": "AssetMang:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "AssetMang:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"AssetMang-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "AssetMang:serve"
},
"configurations": {
"production": {
"devServerTarget": "AssetMang:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "AssetMang"
}

最佳答案

如问题 15175 中所述,检查您的构建输出。如果出现错误或违反预算,index.html不会生成文件。

Build at: 2021-07-11T22:17:50.237Z - Hash: 085ada49cbe5750a0a86 - Time: 47523ms

Warning: initial exceeded maximum budget. Budget 500.00 kB was not met by 559.07 kB with a total of 1.03 MB.

Error: initial exceeded maximum budget. Budget 1.00 MB was not met by 35.07 kB with a total of 1.03 MB.
构建必须成功才能生成索引。

关于angular - ng build --prod index.html 文件没有生成后?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57495330/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com