Angular build index.html not working

John Willson picture John Willson · Mar 7, 2018 · Viewed 11.4k times · Source

I have taken the build of angular project and got dist folder.when i am trying to open the index.html in browser.I am getting the following error like failed to load resources and file not found for inline.bundle.js ,polyfil.bundle.js and many files. enter image description here Though this files added in the script tag and i didnt change the path of this file still not working.But if i run this from live server it is working. enter image description here Explain why it is not working without server? Why it is not loading the inline.bundle.js,polyfill.bundle.js which are js file?

Answer

Zooly picture Zooly · Mar 7, 2018

Your files are not found because base URL changed.

You can workaround this one by using <base href="./"> in your index.html.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base