> For the complete documentation index, see [llms.txt](https://gpeterhand.gitbook.io/react/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gpeterhand.gitbook.io/react/sborka-proekta-1/html-webpack-plugin.md).

# html-webpack-plugin

Предназначен для автоматического создания файла index.html при сборке проекта

Удаляем папку **./dist**

Устанавливаем [html-webpack-plugin](https://webpack.js.org/plugins/html-webpack-plugin/)

> yarn add html-webpack-plugin

В файл **webpack.config.js** добавляем:

```javascript
const HtmlWebpackPlugin = require('html-webpack-plugin')
...

const plugins = [
    ...,
    new HtmlWebpackPlugin({
      templateContent: '<div id="root"></div>'
    })
 ...
```

Теперь файл **dist/index.html** будет создаваться автоматически в процессе сборки

***Примечание:** из **webpack.config.js** следующий фрагмент можно удалить*

```javascript
  devServer: {
    contentBase: './dist'
  },
```
