text: const path = require('path');
  const webpack = require('webpack');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const WebpackMd5Hash = require('webpack-md5-hash');
  const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  
  const isDev = process.env.NODE_ENV === 'development';
  
  
  module.exports = {
    entry: { main: './public/src/main.js' },
    output: {
      path: path.resolve(__dirname, 'public/dist'),
      filename: '[name].[chunkhash].js',
    },
    module: {
      rules: [
        { // тут описываются правила
          test: /\.js$/, // regexp, finds all JS files
          use: { loader: 'babel-loader' }, // all JS files are processed by babel-loader
          exclude: /node_modules/,
        },
        {
          test: /\.(gif|png|jpe?g|ico|svg)$/i,
          use: [
            'file-loader?name=./images/[name].[ext]',
            {
              loader: 'image-webpack-loader',
              options: {
                esModule: false,
              },
            },
          ],
        },
        {
          test: /\.css$/i,
          use: [
            (isDev ? 'style-loader' : MiniCssExtractPlugin.loader),
            'css-loader',
            'postcss-loader',
          ],
        },
        {
          test: /\.(eot|ttf|woff|woff2)$/,
          loader: 'file-loader?name=./public/src/vendor/[name].[ext]',
        },
      ],
    },
    plugins: [
      new MiniCssExtractPlugin({ filename: 'style.[contenthash].css' }),
      new HtmlWebpackPlugin({
        inject: false, // no styles inside HTML tags
        template: './public/src/index.html', // where the template is
        filename: 'index.html', // resulting file in dist folder
      }),
      new WebpackMd5Hash(),
      new webpack.DefinePlugin({
        NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      }),
      new OptimizeCssAssetsPlugin({
        assetNameRegExp: /\.css$/g,
        cssProcessor: require('cssnano'),
        cssProcessorPluginOptions: {
          preset: ['default'],
        },
        canPrint: true,
      }),
    ],
  };
  