考虑:HTML-的WebPack-插件与哈巴狗装载机不拾取选项
plugins: [
new HtmlWebpackPlugin({
template: 'index.pug',
title: 'Page Title',
custom: 'Custom'
})
]
内index.pug
:
doctype html
html
head
meta(charset="utf-8")
meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width, initial-scale=1")
title= htmlWebpackPlugin.options.title
我希望得到拾起自定义标题,但它输出取而代之的是Webpack App
(并且custom
变量是undefined
)。
- 的WebPack 1.15.0
- HTML-的WebPack-插件2.30.1
- 哈巴狗2.0.0 rc.4
我在束手无策就在这里,我感觉这是我错过的东西。
'htmlWebpackPlugin'选项只能在'.ejs'文件。 – imcvampire
@imcvampire认真吗?这是记录在哪里? – Ivan
它仅默认支持'ejs'。但你可以配置使用另一个加载器 – imcvampire