I have a webpack.config.js that scans a config folder to build different bundles in different output folders so that each of those output folders can be a standalone website. For each of those output folders, I want to inject the folder’s contenthash’d bundle into src/template.html to yield an index.html written to each output folder.
The official webpack docs recommend HtmlWebpackPlugin when one wants to use an html template, but when I try (using v5.6.0 of the plugin)…
plugins: [
new HtmlWebpackPlugin({
filename: '[name]index.html'
,template: './src/template.html'
})
]
…it injects all the bundles from all my output folders into each index.html.
I have looked through the github page of the plugin, and the source of its index.js, but I cannot find a way to limit each index.html’s bundle to just the one in the same output folder.
I can’t use the chunks
property unless it can take a value like [contenthash].js
The documentation mentions only fully-specified values, not placeholders.