1
我的目標是在我的index.html文件替換像的WebPack替換的佔位符同捆散列的index.htm
<!--configjs-->
一個字符串
<script src="/api/config?bundle-hash"></script>
我使用https://github.com/AngularClass/NG6-starter
plugins: [
// Injects bundles in your index.html instead of wiring all manually.
// It also adds hash to all injected assets so we don't have problems
// with cache purging during deployment.
new HtmlWebpackPlugin({
template: 'client/index.html',
inject: 'body',
hash: true
})
]
謝謝@cgatian但它不工作替換缺少與注入:假或注入:真,但我必須設置爲'身體'來管理腳本標記我的意思是如果我窺視到html源我仍然看到<%= htmlWebpackPlugin.files ['bundle-hash']。entry%> – Whisher
我已經用當前的HtmlWebpackPlugin更新了我的帖子 – Whisher
我不得不使用'htmlWebpackPlugin.files.chunks.main.entry'。只要將'<%= JSON.stringify(htmlWebpackPlugin.files)%>'放入你的html中,並親自看看路徑應該如何。 – velop