Option 1
In your index.js
file (i.e. webpack entry) add a require to your index.html
via file-loader plugin, e.g.:
require('file-loader?name=[name].[ext]!../index.html');
Once you build your project with webpack, index.html
will be in the output folder.
Option 2
Use html-webpack-plugin to avoid having an index.html at all. Simply have webpack generate the file for you.
In this case if you want to keep your own index.html
file as template, you may use this configuration:
{
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
}
See the docs for more information.