text: const path = require('path');
  const webpack = require('webpack');
  const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
  const CleanWebpackPlugin = require('clean-webpack-plugin');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  
  const pathsToClean = ['dist/*.*'];
  //const devMode = process.env.NODE_ENV !== 'production';
  devMode = false;
  
  module.exports = {
    mode: 'development',
    entry: './src/js/index.js',
    output: {
      filename: devMode ? 'main.js' : 'main.[hash].js',
      path: path.resolve(__dirname, 'dist')
    },
    devServer: {
      contentBase: path.join(__dirname, 'dist'),
      port: 8888,
      hot: true
    },
    optimization: {
      minimizer: [
        new UglifyJsPlugin({}),
        new OptimizeCSSAssetsPlugin({})
      ]
    },
    module: {
    	rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          loader: 'babel-loader',
        },
        {
    			test: /\.css$/,
          use: [
            devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
            "css-loader"
          ]
    		},
    		{
    			test: /\.scss$/,
          use: [
            devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
            'css-loader',
            'postcss-loader',
            'sass-loader',
          ],
    		},
        {
          test: /\.(png|jpe?g|gif|svg)$/i,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: 'img/[name].[ext]',
              }
            },
          ]
        },
        {
          test: /\.(ttf|eot|woff|woff2)$/i,
          loader: "file-loader",
          options: {
            name: "fonts/[name].[ext]",
          },
        }
    	]
    },
    plugins: [
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      new CleanWebpackPlugin(pathsToClean),
      new MiniCssExtractPlugin({
        // Options similar to the same options in webpackOptions.output
        // both options are optional
        filename: devMode ? '[name].css' : '[name].[hash].css',
        chunkFilename: devMode ? '[id].css' : '[id].[hash].css',
      }),
      new HtmlWebpackPlugin({
        title: 'Home',
        template: './src/index.html', // Load a custom template (lodash by default)
        filename: 'index.html'
      }),
    ],
  }
  