How can I configure webpack html plugin to only generate script tags not html, body, head tags.
How can I configure webpack html plugin to only generate script tags not html, body, head tags.
You can configure html-webpack-plugin to build the file based on a custom template. If the template does not have a <body> tag, the script includes are simply appended to the end of the file. There are more advanced configuration options available as described in the project documentation, but for your purpose all you need is to create an empty file named e.g. includes.html, and then specify it as the template in webpack.config.js:
module.exports = {
...
plugins: [
new HtmlWebpackPlugin({
template: 'includes.html'
})
]
...
}
If a completely empty file does not work, just add a newline or a html comment.