html-webpack-plugin with pug-loader not picking up options

Viewed 1290

Consider:

plugins: [
  new HtmlWebpackPlugin({
    template: 'index.pug',
    title: 'Page Title',
    custom: 'Custom'
  })
]

Inside 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

I would expect the custom title to get picked up, but it outputs the default Webpack App instead (and the custom variable is undefined).

  • webpack 1.15.0
  • html-web-pack-plugin 2.30.1
  • pug 2.0.0-rc.4

I'm at my wits' end here, and I get the feeling it's something obvious I missed.

1 Answers
Related