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="./"> 即可。
