I have a Node Express project with Angular added through Angular CLI, ie ng new
.
I do not want the Angular output to wipe out the distribution folder.
I understand there is a delete-output-path
parameter that can be put on the command line to ng build
.
Is it possible to put this in angular-cli.json?
Or should it be in tsconfig.json? Under which property?
--output-hashing all — hash contents of the generated files and append hash to the file name to facilitate browser cache busting (any change to file content will result in different hash and hence browser is forced to load a new version of the file)
ng buildlink. Compiles an Angular application or library into an output directory named dist/ at the given output path.
For Angular CLI 6+ you have to edit angular.json file. You have to set deleteOutputPath
false
in build options
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "../dist",
"deleteOutputPath": false, <--------------------------- put here
"index": "src/index.html",
Yes, you can. You have to put it under defaults property of .angular-cli.json like this:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "project-name"
},
"apps": [
{// app property values here}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"component": {},
"serve": {
"port": 3000
},
"build": {
"deleteOutputPath": false
}
}
}
If you want to learn more about this file's structure, you can go here
Hope it helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With