I have test data located under assets/test/
that I don't want to be included in a production deployment.
How do I configure @angular/cli
to ignore / exclude that folder when running ng build --prod
?
Adding an exclude
section to the tsconfig.json
as suggested elsewhere did not result in any observable change (i.e. the files where still under dist/assets/test
after ng build --prod
was run).
"compilerOptions": { ... },
"exclude" : [ "src/assets/test" ]
Is tere another way to properly exclude certain files or folders from the ng build
process?
Maybe a little too late, anyway you can get the behaviour you desire by specifiyng the assets content as a glob in your angular.json
file:
"projects": {
"myapp": {
"architect": {
"build": {
"options": {
"assets": [
{ "glob": "**/*", "input": "src/assets", "ignore": ["**/test/*"], "output": "/assets" }
]
}
}
}
}
}
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