{"size": 1814, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "builtbyedgar/electron-boilerplate", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "builtbyedgar/electron-boilerplate", "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": "builtbyedgar/electron-boilerplate", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.0930232558, "max_line_length": 90, "alphanum_fraction": 0.5275633958}
var path = require('path')
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')

/*
 * General config
 */
var config = {
  entry: {
    'js/app.js': './app/app.js',
    'css/main.css': './app/scss/main.scss',
  },
  output: {
    path: __dirname + '/public',
    filename: '[name]',
  },
  devServer: {
    hot: true,
    inline: false,
    historyApiFallback: true,
    contentBase: __dirname + '/public',
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: [/node_modules/],
        use: [{
          loader: 'babel-loader',
          options: {
            presets: ['es2015', 'stage-1', 'react'],
            plugins: ['transform-decorators-legacy']
          },
        }],
      },
      {
        test: /\.css$/,  // NOTE: se necesita realmente?
        use: ['style-loader', 'css-loader'],
      },
      {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
          loader: "css-loader!sass-loader",
        }),
      }
    ],
  },
}

/*
 * Bundling for production
 */
if (process.env.NODE_ENV !== 'production') {
  config.devtool = 'true'
  config.plugins = [
    new ExtractTextPlugin({
      filename: 'css/main.css',
      disable: false,
      allChunks: true,
    }),
  ]
} else {
  config.devtool = 'false'
  config.plugins = [
    new ExtractTextPlugin({
      filename: 'css/main.css',
      disable: false,
      allChunks: true,
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        unused: true,
        drop_console: true
      },
      output: {
        comments: false
      }
    }),
    new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') }})
  ]
}

module.exports = config
