我最近構建了一個簡單的 Angular 應用程式,并決定在企業 github 頁面上發布。我使用了以下方法:
cd App
npm install
ng build --prod
cd ../app-github-pages-repo
cp -R ../App/dist/app/* .
git commit -m "Added the app"
git push
在 github 設定中,我看到了訊息
Your site is published at https://host/pages/orgname/
但是當我嘗試訪問它時,它的資源沒有下載,頁面也沒有出現
uj5u.com熱心網友回復:
您錯過了為您的應用設定 base-href。這是必不可少的,因為您的應用程式未托管在域的根目錄中。
您可以嘗試如下構建應用程式:
ng build --prod --base-href https://host/pages/orgname/
確保 base-href 實際上指向源的根所在的位置并按照您的其余步驟操作。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/453986.html
