7
<script src="~/angular/runtime*"></script>
<script src="~/angular/polyfills*"></script>
<script src="~/angular/vendor*"></script>
<script src="~/angular/main*"></script>

enter image description here

I want to add these scripts in my Layout page

3
  • 1
    How have those files been built? I guess there should be an option to remove the hashes in those filenames in your javascript built pipeline Commented Dec 18, 2018 at 10:55
  • I build those files from npm through ng build --prod command Commented Dec 18, 2018 at 11:10
  • Try ng build --outputHashing=none or ng build --prod --output-hashing none Commented Dec 18, 2018 at 11:13

1 Answer 1

6

As far as I can tell, the hashes in your js file names are caused by the --prod flag in the angular-cli.

You basically have to options here:

  • remove the --prod flag
  • add --output-hashing none flag

That means you would end up with a build command similar to this:

ng build --prod --output-hashing none

Please note, that the hashes serve a specific purpose: Cache-Busting. Everytime you generate a new build, these hashes change and if you inject the script(s) automatically into a html file using the angular-cli, this has the benefit of not needing to check if you have to clear your cache and if the changes have been picked up by your browser or if they have been served from disk.

Documentation: https://angular.io/cli/build

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.