{"size": 1286, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "abagames/particle-pattern-emitter", "max_stars_repo_stars_event_min_datetime": "2016-08-22T13:12:18.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-21T02:09:32.000Z", "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "abagames/particle-pattern-emitter", "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": "abagames/particle-pattern-emitter", "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": 24.7307692308, "max_line_length": 74, "alphanum_fraction": 0.5513219285}
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

const sampleName = "mines";

module.exports = function(env) {
  const config = {
    mode: process.env.WEBPACK_SERVE ? "development" : "production",
    resolve: {
      extensions: [".ts", ".js"],
      modules: ["node_modules", "web_modules"]
    },
    module: {
      rules: [
        {
          test: /\.ts$/,
          exclude: /(node_modules|web_modules)/,
          loader: "awesome-typescript-loader"
        }
      ]
    }
  };
  if (!process.env.WEBPACK_SERVE && (env == null || env.sample == null)) {
    config.entry = "./src/index.ts";
    config.output = {
      path: path.join(__dirname, "build"),
      filename: "index.js",
      library: ["ppe"],
      libraryTarget: "umd"
    };
    config.module.rules[0].query = {
      declaration: true,
      declarationDir: "typings"
    };
  } else {
    config.entry = "./src/samples/" + sampleName + ".ts";
    config.output = {
      path: path.join(__dirname, "docs"),
      filename: sampleName + ".js"
    };
    config.plugins = [
      new HtmlWebpackPlugin({
        template: "src/samples/index.html",
        filename: "index.html",
        title: sampleName,
        inject: false
      })
    ];
  }
  return config;
};
