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