{"size": 2189, "ext": "js", "max_stars_repo_path": "webpack.config.prod.js", "max_stars_repo_name": "Fasibru/JATLA_Project_Management", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "webpack.config.prod.js", "max_issues_repo_name": "Fasibru/JATLA_Project_Management", "max_issues_repo_issues_event_min_datetime": "2019-07-22T20:38:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-17T22:22:13.000Z", "max_forks_repo_path": "webpack.config.prod.js", "max_forks_repo_name": "Fasibru/JATLA_Project_Management", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 28.4285714286, "max_line_length": 96, "alphanum_fraction": 0.5632709}
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
// const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');

module.exports = {
  entry: ['@babel/polyfill', './src/client/index.tsx'],
  resolve: {
    extensions: ['.ts', '.tsx', '.js', '.jsx'],
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/',
  },
  module: {
    rules: [
      // {
      //   // pass all js files except for those in the node_modules folder through babel-loader
      //   // this transforms JSX to Javascript
      //   test: /\.js$/,
      //   exclude: /node_modules/,
      //   use: {
      //     loader: 'babel-loader',
      //   },
      // },
      {
        test: /\.ts(x?)$/,
        exclude: /node_modules/,
        use: {
          loader: 'ts-loader',
        },
      },
      /* pass all scss files through
        1. sass-loader (compiles Sass to CSS, using Node Sass by default)
        2. css-loader (translates CSS into CommonJS)
        3. postcss-loader (apply postCSS fixes like autoprefixer)
        4. style-loader (injects <style> tag in DOM)
      */
      {
        test: /\.(sa|sc|c)ss$/,
        use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'],
        // use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
      },
      {
        test: /\.(png|svg|jpg|gif)$/,
        use: [
          'file-loader',
        ],
      },
    ],
  },
  plugins: [
    // output some progress stats
    new webpack.ProgressPlugin(),

    // plugin to remove/clean your build folder
    new CleanWebpackPlugin(),

    // to auto insert <script> tag into index.html which serves the index_bundle.js
    new HtmlWebpackPlugin({
      template: 'public/index.html',
    }),

    // create a CSS file per JS file which contains CSS
    // new MiniCssExtractPlugin({
    //   filename: '[name].css',
    //   chunkFilename: '[id].css',
    // }),
  ],
  optimization: {
    minimizer: [new TerserPlugin()],
  },
};
