text: const path = require('path');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const TerserPlugin = require('terser-webpack-plugin');
  const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  const CopyWebpackPlugin = require('copy-webpack-plugin');
  
  module.exports = (env, options) => {
    const devMode = options.mode !== 'production';
  
    return {
      optimization: {
        minimizer: [
          new TerserPlugin({ cache: true, parallel: true, sourceMap: devMode }),
          new OptimizeCSSAssetsPlugin({})
        ]
      },
      entry: {
        app: './js/app.js',
        app2: './js/app2.js',
        embed: './js/embed.js',
        iframe: './js/iframe.js'
      },
      output: {
        filename: '[name].js',
        path: path.resolve(__dirname, '../priv/static/js')
      },
      devtool: devMode ? 'source-map' : undefined,
      module: {
        rules: [
          {
            test: /\.js$/,
            exclude: /node_modules/,
            use: {
              loader: 'babel-loader'
            }
          },
          {
            test: /\.[s]?css$/,
            use: [
              MiniCssExtractPlugin.loader,
              'css-loader',
              'sass-loader',
            ]
          },
          {
            test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
            use: [
              {
                loader: 'file-loader',
                options: { name: '[name].[ext]', outputPath: '../fonts' }
              },
            ],
          },
          {
            test: require.resolve('jquery'),
            use: [{
              loader: 'expose-loader',
              options: 'jQuery'
            }, {
              loader: 'expose-loader',
              options: '$'
            }]
          }
        ]
      },
      plugins: [
        new MiniCssExtractPlugin({ filename: '../css/[name].css' }),
        new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
      ],
      stats: 'errors-only'
    }
  };
  