Angular CLI build without index.html
You can concatenate commands in the scripts
section of package.json
. So append a delete command and create something like this (Windows command; adapt it to your system):
"scripts": {
"build prod": "ng build --prod --env=prod -op dist && del dist\\index.html"
}
In case anyone is still having the same issue, this is how I solved it.
In your angular.json
:
"architect": {
"build": {
...
"configurations": {
"production": {
"index": "", // Do not copy index.html
...
ng build --prod
will not copy the HTML file, while ng build
and ng serve
will keep using it as expected.