text: const path = require('path');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const WebpackMd5Hash = require('webpack-md5-hash');
  const webpack = require('webpack');
  const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  
  const isDev = process.env.NODE_ENV === 'development';
  
  module.exports = {
    entry: { main: './src/pages/index/index.js', saved_news: './src/pages/saved-news/saved-news.js' },
    output: {
      path: path.resolve(__dirname, 'dist'),
      filename: 'js/[name].[chunkhash].js'
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          use: { loader: 'babel-loader' },
          exclude: /node_modules/
        },
        {
          test: /\.ico$/,
          use: [
            {
              loader: 'file-loader',
              options: {
                esModule: false,
                name: 'favicon/[name].[ext]'
              }
            }
          ]
        },
        {
          test: /\.(png|jpe?g|gif|svg)$/,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: 'images/[name].[ext]',
                esModule: false
              }
            },
            {
              loader: 'image-webpack-loader',
              options: {
                mozjpeg: {
                  progressive: true,
                  quality: 65
                },
                optipng: {
                  enabled: false
                },
                gifsicle: {
                  interlaced: false
                },
                pngquant: {
                  quality: [0.65, 0.9],
                  speed: 4
                }
              }
            }
          ]
        },
        {
          test: /\.(woff|woff2|ttf|otf|eot)$/i,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: 'vendor/[name].[ext]'
              }
            }
          ]
        },
        {
          test: /\.css$/,
          use: [
            isDev
              ? { loader: 'style-loader' }
              : { loader: MiniCssExtractPlugin.loader, options: { publicPath: '../' } },
            'css-loader',
            'postcss-loader'
          ]
        }
      ]
    },
    resolve: {
      alias: {
        images: path.resolve(__dirname, 'images')
      }
    },
    devServer: {
      overlay: true
    },
    plugins: [
      new MiniCssExtractPlugin({ filename: './style/[name].[contenthash].css' }),
      new HtmlWebpackPlugin({
        inject: false,
        hash: true,
        template: './src/pages/index/index.html',
        filename: 'index.html'
      }),
      new HtmlWebpackPlugin({
        inject: false,
        hash: true,
        template: './src/pages/saved-news/saved-news.html',
        filename: 'saved-news.html'
      }),
      new OptimizeCssAssetsPlugin({
        assetNameRegExp: /\.css$/g,
        cssProcessor: require('cssnano'),
        cssProcessorPluginOptions: {
          preset: ['default']
        },
        canPrint: true
      }),
      new WebpackMd5Hash(),
      new webpack.DefinePlugin({
        NODE_ENV: JSON.stringify(process.env.NODE_ENV)
      })
    ]
  };
  