我创建了一个angular 6应用程序。它的目录结构是常规的,例如project / src / assets。生成项目后,在dist文件夹中,有许多已编译的文件,例如图像,它们专门用于背景以及字体文件中。如何避免这种垃圾?
这是angular.json文件中代码的一部分。
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/projectabc",
"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/sass/main.scss",
],
"scripts": [
"src/assets/js/jquery-ui.js",
"src/assets/js/custom.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
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "projectabc:build"
},
"configurations": {
"production": {
"browserTarget": "projectabc:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "projectabc: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/sass/main.scss",
],
"scripts": [],
"assets": [
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server/icicipru",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
}
}
}
答案 0 :(得分:0)
dist目录代表包含所有资产的完全编译的项目。您不应该将任何东西复制到生产环境中,这就是所有资产都在那里的原因。