I am developing using standard localhost:4200. But I also want to see how a build works. For that I have modified angular.json file. The change looks like this:
"outputPath": "D:/a_root/dist",
Where a_root is the application root folder where all the back end files are and web.config is. So, in order to not to mess backend and frontend files I want to place all frontend files into a subfolder /dist. What I am trying to do is this. There is a file index.html that is in my project. I am changing base tag to this:
<base href="/dist">
Then I build the app:
ng build --watch=true
and get dist folder in the correct location. Then I copy index.file from the dist folder into a_root to run the app.
Index.file looks like this:
<head>
<base href="/dist/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="assets/favicon.ico">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css"
rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
</head>
<body class="app" style="overflow-y: hidden;">
<script src="runtime.js"></script><script src="polyfills-es5.js" nomodule></script><script
src="polyfills.js"></script><script src="styles.js"></script>
<script src="scripts.js"></script><script src="vendor.js"></script>
<script src="main.js"></script>
</body>
</html>
When running it as localhost/a_root/index.html I am getting script errors right away because they are not referenced properly. But even prefacing them with dist/ helps to load scripts but not helping to run the app. It fails loading first ts component.
What am I doing wrong here?
Thanks