我已经在github页面上成功发布了我的应用程序,但我的网站没有显示任何内容。 这是我的github存储库链接:https://github.com/chirag299051/Ice-and-Fire
我在控制台中遇到的错误:
inline.318b50c57b4eba3d437b.bundle.js Failed to load resource: the server responded with a status of 404 ()
polyfills.b6b2cd0d4c472ac3ac12.bundle.js Failed to load resource: the server responded with a status of 404 ()
scripts.e2cc764d74d6cb8d1c42.bundle.js Failed to load resource: the server responded with a status of 404 ()
main.54e8c9147109b23af744.bundle.js Failed to load resource: the server responded with a status of 404 ()
styles.a9b0b1037568d3083749.bundle.css Failed to load resource: the server responded with a status of 404 ()
polyfills.b6b2cd0d4c472ac3ac12.bundle.js Failed to load resource: the server responded with a status of 404 ()
scripts.e2cc764d74d6cb8d1c42.bundle.js Failed to load resource: the server responded with a status of 404 ()
main.54e8c9147109b23af744.bundle.js Failed to load resource: the server responded with a status of 404 ()
styles.a9b0b1037568d3083749.bundle.css Failed to load resource: the server responded with a status of 404 ()
答案 0 :(得分:1)
您的脚本位于https://chirag299051.github.io/Ice-and-Fire
,而您的应用正在尝试从https://chirag299051.github.io/
获取它们。
制作它以便您从https://chirag299051.github.io/Ice-and-Fire
获取脚本。
例如,https://chirag299051.github.io/main.54e8c9147109b23af744.bundle.js
应为https://chirag299051.github.io/Ice-and-Fire/main.54e8c9147109b23af744.bundle.js
。
您可以通过使用--base-href
标记构建项目并在<base href>
,see the documentation for more information.
index.html
标记来设置这些路径
在您的情况下,这会导致
ng build --base-href=/Ice-and-Fire/
和index.html
看起来像这样
<html>
<head>
<base href="/Ice-and-Fire/">
...
</head>
<body>...</body>
</html>