const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
  entry: {
    'auth-login-form': [
      './src/login-form/main.ts'
    ],
    'auth-admins-list': [
      './src/admins/list/main.ts'
    ],
    'auth-admins-form': [
      './src/admins/form/main.ts'
    ],
  },
  output: {
    path: path.resolve(__dirname, '../../../public/admin-js'),
    filename: '[name].js'
  },
  resolve: {
    alias: {
      '@common': path.resolve(__dirname, '../../../Common/assets'),
    },
    extensions: ['*', '.ts', '.js', '.json']
  },
  module: {
    rules: [
      {
        test: /\.ts?$/,
        use: 'ts-loader',
        exclude: /node_modules/,
      },
      {
        enforce: 'pre',
        test: /\.js$/,
        loader: 'source-map-loader',
      },
    ],
  },
  devtool: 'source-map',
  mode: 'development',
  // mode: 'production',
  // optimization: {
  //     minimize: true,
  //     minimizer: [new TerserPlugin({
  //       terserOptions: {
  //         format: {
  //           comments: false,
  //         },
  //       },
  //       extractComments: false,
  //     })],
  // },
}