鍍金池/ 問答/HTML5/ angular打包

angular打包

  1. 我在使用ng build --prod命令打包后,index.html文件中的script標簽如下:<script type="text/javascript" src="polyfills.abdf53ca655716e505e0.bundle.js"></script>。
  2. 由于我的服務(wù)端使用http://localhost:8000/a為開頭,瀏覽器無法請求http://localhost:8000/polyfills.abdf53ca655716e505e0.bundle.js文件。
  3. 我怎樣使用打包命令,或著有其他方法為script標簽的src屬性添加/a前綴?
  4. index.html中的一些樣式文件和其他script標簽都有同樣問題。
回答
編輯回答
法克魷

在head中增加base標簽。

<head>
    <base href="/">
</head>
2017年4月15日 09:50