How build index.html with ./ instead of / bundle src in html-webpack-plugin

84 views Asked by At

My html-webpack-plugin builds a index.html with bundle src to /main[hash].html

<script type="text/javascript" src="/main.dde2e5563b4d5cd56173.js"></script>

How to make it build index.html with ./ at the beginning of the src url? Like so:

<script type="text/javascript" src="./main.dde2e5563b4d5cd56173.js"></script>
1

There are 1 answers

0
natevw On BEST ANSWER

Add a publicPath setting to your output configuration. See https://github.com/jantimon/html-webpack-plugin/issues/694 for a more complete example; in your case you probably want something like this in your webpack config:

module.exports = {
  // …
  output: {
    // …
    publicPath: '.'
  },
  //…
}