{"size": 3417, "ext": "js", "max_stars_repo_path": "src/site/webpack.config.js", "max_stars_repo_name": "nicholaschiang/tutorbook", "max_stars_repo_stars_event_min_datetime": "2019-05-02T01:23:36.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-23T18:41:30.000Z", "max_issues_repo_path": "src/site/webpack.config.js", "max_issues_repo_name": "nicholaschiang/tutorbook", "max_issues_repo_issues_event_min_datetime": "2019-05-23T18:44:48.000Z", "max_issues_repo_issues_event_max_datetime": "2019-10-16T19:32:27.000Z", "max_forks_repo_path": "src/site/webpack.config.js", "max_forks_repo_name": "nicholaschiang/tutorbook", "max_forks_repo_forks_event_min_datetime": "2019-10-14T05:33:10.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-14T05:33:10.000Z"}
{"max_stars_count": 2, "max_issues_count": 6, "max_forks_count": 1, "avg_line_length": 26.905511811, "max_line_length": 76, "alphanum_fraction": 0.375182909}
const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');

module.exports = (env, argv) => [
  {
    watch: argv.mode === 'development',
    devtool: argv.mode === 'development' ? 'eval-source-map' : 'none',
    entry: path.resolve(__dirname, 'packages/site/index.js'),
    output: {
      filename: 'index.js',
      path: path.resolve(__dirname, '../../build/'),
    },
    resolve: {
      extensions: ['.scss', '.js'],
    },
    module: {
      rules: [
        {
          test: /\.s[ac]ss$/i,
          use: [
            'to-string-loader',
            'css-loader',
            {
              loader: 'sass-loader',
              options: {
                implementation: require('sass'),
                sassOptions: {
                  fiber: require('fibers'),
                  includePaths: [
                    // TODO: See #52.
                    path.resolve(
                      __dirname,
                      'packages/error-msg/' + 'node_modules'
                    ),
                    path.resolve(__dirname, 'node_modules'),
                  ],
                },
              },
            },
          ],
        },
        {
          test: /\.html$/i,
          use: [
            'to-string-loader',
            {
              loader: 'html-loader',
              options: {
                esModule: true,
                minimize:
                  argv.mode === 'production'
                    ? {
                        collapseBooleanAttributes: true,
                        collapseWhitespace: true,
                        decodeEntities: true,
                        minifyCSS: true,
                        minifyJS: true,
                        quoteCharacter: '"',
                        removeComments: true,
                        removeOptionalTags: true,
                        removeRedundantAttributes: true,
                        removeScriptTypeAttributes: true,
                        removeStyleLinkTypeAttributes: true,
                        removeTagWhitespace: true,
                        sortAttributes: true,
                        sortClassName: true,
                        useShortDoctype: true,
                      }
                    : false,
              },
            },
          ],
        },
        {
          test: /\.svg$/i,
          use: 'svg-url-loader',
        },
      ],
    },
    optimization: {
      minimize: argv.mode === 'production',
      minimizer: [
        new TerserPlugin({
          extractComments: false,
          terserOptions: {
            output: {
              comments: false,
            },
          },
        }),
      ],
    },
  },
  {
    watch: argv.mode === 'development',
    entry: './packages/site/index.scss',
    output: {
      filename: 'index.css.js', // TODO: Don't generate this unused JS file.
      path: path.resolve(__dirname, '../../build/'),
    },
    module: {
      rules: [
        {
          test: /\.s[ac]ss$/i,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: 'index.css',
              },
            },
            {
              loader: 'extract-loader',
            },
            {
              loader: 'css-loader',
            },
            {
              loader: 'sass-loader',
            },
          ],
        },
      ],
    },
  },
];
