I am trying to automate assets going into /dist. I have the following config.js:
module.exports = {
context: __dirname + "/lib",
entry: {
m
To copy an already existing index.html file into the dist directory you can simply use the HtmlWebpackPlugin by specifying the source index.html as a template.
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
// ...
plugins: [
new HtmlWebpackPlugin({
template: './path/to/index.html',
})
],
// ...
};
The created dist/index.html file will be basically the same as your source file with the difference that bundled resources like .js files are injected with tags by webpack. Minification and further options can be configured and are documented on github.