<commit_before>'use strict'

var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin')
var DashboardPlugin = require('webpack-dashboard/plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var merge = require('webpack-merge')
var path = require('path')
var WebpackChunkHash = require('webpack-chunk-hash')
var WebpackCleanupPlugin = require('webpack-cleanup-plugin')
var webpack = require('webpack')

const baseConfig = () => ({
  entry: [
    path.join(__dirname, '/src/index.js')
  ],
  resolve: {
    extensions: ['.js']
  },
  module: {
    rules: [
      {
        test: /\.js?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'babel-loader'
      },
      {
        test: /\.css$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 1,
                modules: true,
                minimize: true
              }
            },
            'postcss-loader'
          ]
        })
      },
      {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'file-loader'
      },
      {
        test: /\.(woff|woff2)$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?prefix=font/&limit=5000'
      },
      {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
      },
      {
        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
      },
      {
        test: /\.gif/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/gif'
      },
      {
        test: /\.jpg/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/jpg'
      },
      {
        test: /\.png/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/png'
      }
    ]
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: ['vendor'],
      minChunks: function (module) {
        return module.context && module.context.indexOf('node_modules') !== -1
      }
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest'
    }),
    new webpack.HashedModuleIdsPlugin(),
    new WebpackChunkHash(),
    new ChunkManifestPlugin({
      filename: 'chunk-manifest.json',
      manifestVariable: 'webpackManifest'
    }),
    new ExtractTextPlugin({
      filename: '[name].css',
      allChunks: true
    }),
    new HtmlWebpackPlugin({
      template: './src/template.html',
      favicon: './src/images/favicon.png'
    })
  ]
})

const configProd = (base) => merge.smart(base(), {
  output: {
    publicPath: './',
    path: path.join(__dirname, 'public'),
    filename: '[name].[chunkhash].js'
  },
  devtool: 'source-map',
  plugins: [
    new WebpackCleanupPlugin(),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      comments: false
    }),
    new webpack.optimize.OccurrenceOrderPlugin()
  ]
})

const configDev = (base) => merge.smartStrategy({ entry: 'prepend' })(base(), {
  entry: [
    // activate HMR for React
    'react-hot-loader/patch',

    // bundle the client for webpack-dev-server
    // and connect to the provided endpoint
    'webpack-dev-server/client?http://localhost:8888',

    // bundle the client for hot reloading
    // only- means to only hot reload for successful updates
    'webpack/hot/only-dev-server'
  ],
  output: {
    // necessary for HMR to know where to load the hot update chunks
    publicPath: '/',

    path: path.join(__dirname, 'public'),

    filename: '[name].js'
  },
  devtool: 'inline-source-map',
  devServer: {
    host: 'localhost',
    port: 8888,

    contentBase: path.resolve(__dirname, 'public'),

    // serve index.html in place of 404 responses to allow HTML5 history
    historyApiFallback: true,

    // enable HMR
    hot: true,

    // embed the webpack-dev-server runtime into the bundle
    inline: true,

    publicPath: '/'
  },
  plugins: [
    // enable HMR globally
    new webpack.HotModuleReplacementPlugin(),

    // more readable module names in the browser console on HMR updates<commit_msg>enable intranet access on webpack dev server<commit_after>'use strict'

var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin')
var DashboardPlugin = require('webpack-dashboard/plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var merge = require('webpack-merge')
var path = require('path')
var WebpackChunkHash = require('webpack-chunk-hash')
var WebpackCleanupPlugin = require('webpack-cleanup-plugin')
var webpack = require('webpack')

const baseConfig = () => ({
  entry: [
    path.join(__dirname, '/src/index.js')
  ],
  resolve: {
    extensions: ['.js']
  },
  module: {
    rules: [
      {
        test: /\.js?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'babel-loader'
      },
      {
        test: /\.css$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 1,
                modules: true,
                minimize: true
              }
            },
            'postcss-loader'
          ]
        })
      },
      {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'file-loader'
      },
      {
        test: /\.(woff|woff2)$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?prefix=font/&limit=5000'
      },
      {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
      },
      {
        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
      },
      {
        test: /\.gif/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/gif'
      },
      {
        test: /\.jpg/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/jpg'
      },
      {
        test: /\.png/,
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'url-loader?limit=10000&mimetype=image/png'
      }
    ]
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: ['vendor'],
      minChunks: function (module) {
        return module.context && module.context.indexOf('node_modules') !== -1
      }
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest'
    }),
    new webpack.HashedModuleIdsPlugin(),
    new WebpackChunkHash(),
    new ChunkManifestPlugin({
      filename: 'chunk-manifest.json',
      manifestVariable: 'webpackManifest'
    }),
    new ExtractTextPlugin({
      filename: '[name].css',
      allChunks: true
    }),
    new HtmlWebpackPlugin({
      template: './src/template.html',
      favicon: './src/images/favicon.png'
    })
  ]
})

const configProd = (base) => merge.smart(base(), {
  output: {
    publicPath: './',
    path: path.join(__dirname, 'public'),
    filename: '[name].[chunkhash].js'
  },
  devtool: 'source-map',
  plugins: [
    new WebpackCleanupPlugin(),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      comments: false
    }),
    new webpack.optimize.OccurrenceOrderPlugin()
  ]
})

const configDev = (base) => merge.smartStrategy({ entry: 'prepend' })(base(), {
  entry: [
    // activate HMR for React
    'react-hot-loader/patch',

    // bundle the client for webpack-dev-server
    // and connect to the provided endpoint
    'webpack-dev-server/client?http://localhost:12335',

    // bundle the client for hot reloading
    // only- means to only hot reload for successful updates
    'webpack/hot/only-dev-server'
  ],
  output: {
    // necessary for HMR to know where to load the hot update chunks
    publicPath: '/',

    path: path.join(__dirname, 'public'),

    filename: '[name].js'
  },
  devtool: 'inline-source-map',
  devServer: {
    host: '0.0.0.0',
    port: 12335,

    contentBase: path.resolve(__dirname, 'public'),

    // serve index.html in place of 404 responses to allow HTML5 history
    historyApiFallback: true,

    // enable HMR
    hot: true,

    // embed the webpack-dev-server runtime into the bundle
    inline: true,

    publicPath: '/'
  },
  plugins: [
    // enable HMR globally
    new webpack.HotModuleReplacementPlugin(),

    // more readable module names in the browser console on HMR updates
{'fraction_non_alphanumeric': 0.15298698637155447, 'fraction_numerical': 0.009632134440004098, 'mean_word_length': 2.032939714108142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5350523', 'n_tokens_mistral': 3118, 'n_tokens_neox': 2987, 'n_words': 597}