{"size": 3410, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "haynescw/react-demo", "max_stars_repo_stars_event_min_datetime": "2020-07-23T19:58:12.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-23T19:58:12.000Z", "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "haynescw/react-demo", "max_issues_repo_issues_event_min_datetime": "2020-10-01T14:55:04.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-31T20:42:24.000Z", "max_forks_repo_path": "webpack.config.js", "max_forks_repo_name": "haynescw/react-demo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 28.1818181818, "max_line_length": 126, "alphanum_fraction": 0.5293255132}
const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const ENVIRONMENT = process.env.NODE_ENV

module.exports  = {
  mode: ENVIRONMENT,
  entry: './src/app.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js',
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: 'babel-loader'
      },
      {
        test: /\.scss$/,
        loader: "style-loader!css-loader!sass-loader!resolve-url-loader!sass-loader?sourceMap"
      },
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          "css-loader"
        ]
      },
      {
        test: /\.(gif|jpg|png|svg|eot|otf|ttf|woff(2)?)(\?[^]*)?$/,
        use: [
          {
            loader: "file-loader"
          }
        ]
      }
    ]
  },
  plugins: [
    new CleanWebpackPlugin(['app']),
    new HtmlWebpackPlugin({
      // Required
      inject: false,
      template: require('html-webpack-template'),
      // template: 'node_modules/html-webpack-template/index.js',

      // Optional
      appMountId: 'app',
      // appMountHtmlSnippet: '<div class="app-spinner"><i class="fa fa-spinner fa-spin fa-5x" aria-hidden="true"></i></div>',
      // headHtmlSnippet: '<style>div.app-spinner {position: fixed;top:50%;left:50%;}</style >',
      // baseHref: 'http://example.com/awesome',
      // devServer: 'http://localhost:3000',
      // googleAnalytics: {
      //   trackingId: 'UA-XXXX-XX',
      //   pageViewOnLoad: true
      // },
      // meta: [
      //   {
      //     name: 'description',
      //     content: 'A better default template for html-webpack-plugin.'
      //   }
      // ],
      // mobile: true,
      // lang: 'en-US',
      // links: [
      //   'https://fonts.googleapis.com/css?family=Roboto',
      //   {
      //     href: '/apple-touch-icon.png',
      //     rel: 'apple-touch-icon',
      //     sizes: '180x180'
      //   },
      //   {
      //     href: '/favicon-32x32.png',
      //     rel: 'icon',
      //     sizes: '32x32',
      //     type: 'image/png'
      //   }
      // ],
      // inlineManifestWebpackName: 'webpackManifest',
      // scripts: [
      //   'http://example.com/somescript.js',
      //   {
      //     src: '/myModule.js',
      //     type: 'module'
      //   }
      // ],
      title: 'My Demo React App',
      // window: {
      //   env: {
      //     apiHost: 'http://myapi.com/api/v1'
      //   }
      // }

      // And any other config options from html-webpack-plugin:
      // https://github.com/ampedandwired/html-webpack-plugin#configuration
    }),
    new MiniCssExtractPlugin({
      // Options similar to the same options in webpackOptions.output
      // both options are optional
      filename: "[name].css",
      chunkFilename: "[id].css"
    }),
    new BrowserSyncPlugin({
      host: 'localhost',
      port: 3000,
      proxy: 'http://localhost:8080/',
      // prevent BrowserSync from reloading the page
      // and let Webpack Dev Server take care of this
      reload: false
    }),
    new webpack.EnvironmentPlugin([
      'NODE_ENV',
    ]),
  ]
}
