{"size": 1165, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "CharlyCast/microReact", "max_stars_repo_stars_event_min_datetime": "2019-12-24T13:11:44.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-03T13:38:53.000Z", "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "CharlyCast/microReact", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "webpack.config.js", "max_forks_repo_name": "CharlyCast/microReact", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.8431372549, "max_line_length": 95, "alphanum_fraction": 0.5433476395}
const HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = env => {
  const pluggins = [
    new HtmlWebpackPlugin({
      inlineSource: ".(ts|tsx|jsx|js|css)$",
      template: "index.html"
    })
  ];
  // Inline JS for production build
  if (env && env.production)
    pluggins.push(new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin));

  return {
    mode: "development",

    entry: "./src/index.tsx",

    // Enable sourcemaps for debugging webpack's output.
    devtool: "source-map",

    resolve: {
      // Add '.ts' and '.tsx' as resolvable extensions.
      extensions: [".ts", ".tsx"]
    },

    module: {
      rules: [
        {
          test: /\.ts(x?)$/,
          exclude: /node_modules/,
          use: [
            {
              loader: "ts-loader"
            }
          ]
        },
        // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
        {
          enforce: "pre",
          test: /\.js$/,
          loader: "source-map-loader"
        }
      ]
    },

    plugins: pluggins
  };
};
