網站搜尋

angular - 如何更改 ng build index.html 的腳本順序


我已將所有 Angular 的 index.html 中的腳本和樣式來源內嵌,以生成單一的 HTML 文件。我是通過運行 ng build --prod 完成的,之後我使用 grunt-html-smoosher 來解析所有的腳本和樣式標籤。結果實際上是一個包含樣式和腳本的單一 HTML 文件。但如果我在瀏覽器中打開它,就會出現以下錯誤:

Uncaught Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)

編輯:

事實上,這個錯誤可以通過將第三個腳本(polyfills-es5)放到最後來解決。

有人知道如何在 ng build --prod 完成後,以程式方式或使用腳本更改腳本的順序嗎?

提前感謝你!