Reputation: 1101
I'm building an Angular (4) Project, in which I seldom use ng serve
, instead I compile the typescript and bundle the js using ng build
, debug using else where.
ng build
thankfully adds refs to bundles js files in the dist
directory.
These following lines are auto generated and added to index.html
by angular-cli when I execute ng build
<script type="text/javascript" src="dist/inline.bundle.js"></script>
<script type="text/javascript" src="dist/polyfills.bundle.js"></script>
<script type="text/javascript" src="dist/styles.bundle.js"></script>
<script type="text/javascript" src="dist/vendor.bundle.js"></script>
<script type="text/javascript" src="dist/main.bundle.js"></script>
But here is the bad part. These lines are added to index.html everytime I call ng build
. Is there any way to turn off the automated addition of references to the html. Its not a major problem, but would be nice to know a way to turn it off in the config.
Upvotes: 1
Views: 1106
Reputation: 11
I had exactly the same problem. ng build --watch
would create an infinite loop as it constantly rebuilt itself responding to its own changes to index.html
Simply changing the outdir
to ../dist
and referencing the files in that location sorted the issue for me.
Upvotes: 1