gpt4 book ai didi

angular - 一个未处理的异常发生 : Configuration 'es5' is not set in the workspace. ng serve in angular 8 for es5

转载 作者:行者123 更新时间:2023-12-03 14:50:31 24 4
gpt4 key购买 nike

发生未处理的异常:工作区中未设置配置“es5”。

当客户希望项目在 Internet Explorer 8 上运行时,问题就开始了。幸运的是,新的 angular 8 提供了差异加载。

根据 angular 的文档( https://angular.io/guide/deployment#differential-loading ),我将 es5 JSON 添加到 angular.json
然后我尝试使用 'ng serve --configuration es5' 为其提供服务

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"sm": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"style": "sass"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Forex-Lottery-Front-End",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/font-awesome/scss/font-awesome.scss",
"./node_modules/bootstrap/dist/css/bootstrap.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/scss/styles.scss"
],
"scripts": [
"./node_modules/jquery/dist/jquery.js"
],
"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": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"es5": {
"tsConfig": "./tsconfig-es5.app.json"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sm:build"
},
"configurations": {
"production": {
"browserTarget": "sm:build:production"
}
},
"es5": {
"browserTarget": "app:build:es5"
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sm: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.scss"
],
"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/**"
]
}
}
}
},
"sm-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "sm:serve"
},
"configurations": {
"production": {
"devServerTarget": "sm:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "sm"
}

错误是

发生未处理的异常:工作区中未设置配置“es5”。
有关更多详细信息,请参阅“/tmp/ng-iPbP2O/angular-errors.log”。

我怎样才能使这项工作?

最佳答案

您似乎将 es5 配置放在“服务”部分,而不是“配置”部分。

您还需要将“app:build:es5”更改为您的应用程序名称。所以在你的情况下是“sm:build:es5”。

"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sm:build"
},
"configurations": {
"production": {
"browserTarget": "sm:build:production"
},
"es5": {
"browserTarget": "sm:build:es5"
}
}
}

关于angular - 一个未处理的异常发生 : Configuration 'es5' is not set in the workspace. ng serve in angular 8 for es5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57722619/

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