{"size": 1784, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "ebi-gene-expression-group/anatomogram", "max_stars_repo_stars_event_min_datetime": "2018-06-07T02:27:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T03:51:10.000Z", "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "ebi-gene-expression-group/anatomogram", "max_issues_repo_issues_event_min_datetime": "2018-04-12T15:43:39.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-30T09:29:52.000Z", "max_forks_repo_path": "webpack.config.js", "max_forks_repo_name": "ebi-gene-expression-group/anatomogram", "max_forks_repo_forks_event_min_datetime": "2018-09-04T14:54:41.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-30T15:17:06.000Z"}
{"max_stars_count": 22, "max_issues_count": 19, "max_forks_count": 16, "avg_line_length": 20.9882352941, "max_line_length": 117, "alphanum_fraction": 0.5072869955}
const path = require(`path`)
const { CleanWebpackPlugin } = require(`clean-webpack-plugin`)

const commonPublicPath = `/dist/`
const vendorsBundleName = `vendors`

module.exports = {
  entry: {
    demo: `./html/AnatomogramDemo.js`
  },

  plugins: [
    new CleanWebpackPlugin({
      cleanOnceBeforeBuildPatterns: `dist`
    })
  ],

  output: {
    library: `[name]`,
    filename: `[name].bundle.js`,
    publicPath: commonPublicPath
  },

  resolve: {
    alias: {
      "react": path.resolve(`./node_modules/react`),
      "react-dom": path.resolve(`./node_modules/react-dom`)
    },
  },

  optimization: {
    runtimeChunk: {
       name: vendorsBundleName
    },
    splitChunks: {
      cacheGroups: {
        commons: {
          test: /[\\/]node_modules[\\/]/,
          name: vendorsBundleName,
          chunks: 'all'
        }
      }
    }
  },

  module: {
    rules: [
      {
        test: /\.js$/i,
        exclude: /node_modules\//,
        use: `babel-loader`
      },
      {
        test: /\.(jpe?g|png|gif)$/i,
        use: [
          { loader: `file-loader` },
          {
            loader: `image-webpack-loader`,
            options: {
              query: {
                bypassOnDebug: true,
                mozjpeg: { progressive: true },
                gifsicle: { interlaced: true },
                optipng: { optimizationLevel: 7 }
              }
            }
          }
        ]
      },
      {
        test: /\.svg$/i,
        use: `file-loader`
      }
    ]
  },

  devServer: {
    port: 9000,
    contentBase: path.resolve(__dirname, `html`),
    publicPath: commonPublicPath
    // Add if developing a SPA to redirect non-matching routes known by WDS (i.e. no document in /html) to the router
    // historyApiFallback: true
  }
}
