我不知道你为什么要配置特定的部署,它已经配置在 中angular.json
,你可以在这个文件中添加一个新的配置,就像提供的运行它的例子一样,
ng build --c=build
或者使用
ng build --c=staging
where c stand to configuration运行第二个confiduration
顺便说一下,你应该得到包含资产文件的 dist 文件夹
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/AngularProject",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config",
"src/WEB-INF"
],
"styles": [
"src/styles.scss",
"src/assets/css/fontawesome-all.min.css",
"src/assets/css/themify-icons.css"
],
"stylePreprocessorOptions": {
"includePaths": [
]
},
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/popper.js/dist/umd/popper.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.js",
"./node_modules/jspdf/dist/jspdf.min.js",
"./node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js"
]
},
"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": "4mb",
"maximumError": "5mb"
}
]
},
"staging": { // a new configuration
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.staging.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "4mb",
"maximumError": "5mb"
}
]
}
}
},
ng build
要部署,使用所需的配置运行就足够了
我不确定我是否知道你的问题是什么