Angular NG Build中的脚本优化--prod在Firebase部署/服务期间导致一个空白屏幕
我一直在努力让我的Angular9应用程序使用Firebase正确部署。在ng build中使用--prod标记时,firebase部署/服务命令会导致一个空白屏幕。在Chrome上检查开发工具的网络选项卡时,文件在dist/projectname文件夹中被正确检索。仅当我在运行“ng build”时未使用--prod标记时,应用程序才成功加载。在修改Angular.json文件中的一些值后,我注意到在--prod构建期间禁用脚本优化会导致在firebase部署/服务期间成功加载。我的问题是,在脚本优化过程中发生了什么可能会导致此问题 这是我的Angular.json文件:Angular NG Build中的脚本优化--prod在Firebase部署/服务期间导致一个空白屏幕,angular,firebase,Angular,Firebase,我一直在努力让我的Angular9应用程序使用Firebase正确部署。在ng build中使用--prod标记时,firebase部署/服务命令会导致一个空白屏幕。在Chrome上检查开发工具的网络选项卡时,文件在dist/projectname文件夹中被正确检索。仅当我在运行“ng build”时未使用--prod标记时,应用程序才成功加载。在修改Angular.json文件中的一些值后,我注意到在--prod构建期间禁用脚本优化会导致在firebase部署/服务期间成功加载。我的问题是,在
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"customer-portal": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/customer-portal",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "dist/ngx-extended-pdf-viewer/assets/",
"output": "/assets/"
}
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.css"
],
"scripts": [
"node_modules/ngx-extended-pdf-viewer/assets/pdf.js",
"node_modules/ngx-extended-pdf-viewer/assets/pdf.worker.js",
"node_modules/ngx-extended-pdf-viewer/assets/viewer.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": {"scripts" : false, "styles": true},
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "20mb",
"maximumError": "20mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "10kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "customer-portal:build"
},
"configurations": {
"production": {
"browserTarget": "customer-portal:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "customer-portal:build"
}
},
"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": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "customer-portal:serve"
},
"configurations": {
"production": {
"devServerTarget": "customer-portal:serve:production"
}
}
},
"deploy": {
"builder": "@angular/fire:deploy",
"options": {}
}
}
}
},
"defaultProject": "customer-portal"
}
任何信息将不胜感激。谢谢大家!