angular4 ng build 后生成的dist 文件夾中顯示無內容的解決辦法。


angular4 ng build 后生成的dist 文件夾中顯示無內容的解決辦法。

現象:

ng serve 命令啟動,localhost:4200瀏覽內容顯示正常,用ng build 打包后,將dist目錄copy到tomcat 下,卻顯示空白

 

解決方法:

將項目/src 目錄下的index.html內容修改

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>AdminConsole</title>
  <base href="./">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root></app-root>
</body>
</html>

  

<base href="/"> 修改為
<base href="./"> 即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM