Use html-webpack-plugin with string-replace-loader in webpack
<p>I'm trying to replace a variable in index.html that looks like this:</p>

<p><code>&lt;meta name='author' content=$variable&gt;</code></p>

<p>In the config file I use:</p>

<pre><code>  {
    test: /index\.html$/,
    loader: 'string-replace',
    query: {
      search: '$variable',
      replace: 'stuff to inject',
    },
  }
</code></pre>

<p>In the <code>loaders</code> array, and then in <code>plugins</code>:</p>

<pre><code>new HtmlWebpackPlugin({
  template: conf.path.src('src/index.html'),
  inject: true,
})
</code></pre>

<p>But this setting results in:</p>

<p><code>ERROR in ./~/html-webpack-plugin/lib/loader.js!./src/index.html
    Module parse failed (...)  Unexpected token (1:0)
    You may need an appropriate loader to handle this file type.</code></p>

<p>Do you have any ideas what this can be caused by or how can I debug this?</p>