text: const path = require('path');
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
  const TerserPlugin = require('terser-webpack-plugin');
  
  module.exports = (env, argv) => {
      const devMode = argv.mode !== 'production';
      const config = {
          entry: './resources',
          output: {
              path: path.resolve(__dirname, './web/dist'),
              filename: devMode ? '[name].js' : '[name].[chunkhash].js'
          },
          module: {
              rules: [{
                  test: /\.(css|scss)$/,
                  use: [
                      MiniCssExtractPlugin.loader,
                      'css-loader',
                      'sass-loader',
                  ]
              }, {
                  test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
                  use: [{
                      loader: 'file-loader',
                      options: { name: '[name].[ext]' }
                  }]
              }]
          },
          plugins: [
              new HtmlWebpackPlugin({
                  template: './resources/css.html',
                  filename: 'css.html',
                  inject: false,
              }),
              new HtmlWebpackPlugin({
                  template: './resources/js.html',
                  filename: 'js.html',
                  inject: false,
              }),
              new MiniCssExtractPlugin({
                  filename: devMode ? '[name].css' : '[name].[hash].css',
              }),
          ],
          devtool: devMode ? 'cheap-eval-source-map' : 'source-map',
          optimization: {
              runtimeChunk: 'single',
              minimizer: [
                  new TerserPlugin(),
                  new OptimizeCSSAssetsPlugin({
                      cssProcessorOptions: { safe: true },
                  })
              ]
          },
      };
      if (! devMode) {
          config.plugins.push(new LicenseWebpackPlugin());
          config.plugins.push(new CleanWebpackPlugin());
      }
      return config;
  };
  