javascriptnode.jsangularnpm-live-server

Angular build index.html not working


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?


Solution

  • 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