Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this possible to change script path in index.html file after build completed?

I have one angular-cli application, when i give ng build command it creates build file which has index.html file.

In index.html file, scripts paths are referred like below:

<script type="text/javascript" **src="runtime.js"**></script>
<script type="text/javascript" **src="polyfills.js"**></script>
<script type="text/javascript" **src="styles.js"**></script>
<script type="text/javascript" **src="vendor.js"**></script>
<script type="text/javascript" **src="main.js"**></script>

But i want to change that script like below,

<script type="text/javascript" **src="~/runtime.js"**></script>
<script type="text/javascript" **src="~/polyfills.js"**></script>
<script type="text/javascript" **src="~/styles.js"**></script>
<script type="text/javascript" **src="~/vendor.js"**></script>
<script type="text/javascript" **src="~/main.js"**></script>

Is it possible to change the path without using find and replace method?

like image 297
Kumaresan Sd Avatar asked Oct 15 '25 15:10

Kumaresan Sd


1 Answers

I have found answer for my question in here.

Please check here

"deployUrl": "/app/", this property helps me to achieve my requirement

Update, 2023 / Angular 16: "deployUrl" has been replaced by "baseHref". This property is added angular.json inside of architect/build/options

like image 82
Kumaresan Sd Avatar answered Oct 19 '25 00:10

Kumaresan Sd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!