I just finished working on an angular 8 app and I am trying to host it on github pages. My problem is that when I try to build the app via ng build --prod
and open the index.html of the dist folder in my browser. It just reads the content of that file and throws a bunch of :
Failed to load resource: net::ERR_FAILED
Access to script at 'file:///D:/weather/Wapp/dist/Wapp/runtime-es2015.edb2fcf2778e7bf1d426.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I tried changing the href in the html manually and via commands and attempted multiple answers of this question but nothing worked.I also want to mention that the built website works fine in a localserver with server-lite.
this is the structure of the dist folder :
D:.
└───Wapp
│ 3rdpartylicenses.txt
│ favicon.ico
│ index.html
│ main-es2015.3597f5e65f4450662a55.js
│ main-es5.3597f5e65f4450662a55.js
│ polyfills-es2015.2987770fde9daa1d8a2e.js
│ polyfills-es5.6696c533341b95a3d617.js
│ runtime-es2015.edb2fcf2778e7bf1d426.js
│ runtime-es5.edb2fcf2778e7bf1d426.js
│ styles.44d5eaa2a1e46e8873ec.css
│
└───assets
rain.svg
wi-sandstorm.svg
any help will be welcome, thank you.