1.angular.json file instructions added at architect buildTest
From location
projects => (your project name) => architect down
and build instructions serve the same level of instruction
"buildTest": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/insuranceTest/", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.less" ], "scripts": [] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.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" } ] } } },
2. Configure the test environment packed instruction
Open the file package.json
Add in the script
"buildTest": "ng run biService:buildTest --build--optimizer --aot ",
3. Use
npm run buildTest
This will execute a packed instruction when the test environment, and the package file will be generated in the test environment dist / insuranceTest path