const webpack = require('webpack');
const path = require('path');


module.exports = {
  entry: [
    path.join(__dirname, 'app/Main.js')
  ],
  output: {
    path: path.join(__dirname, 'public/js'),
    filename: 'bundle.js'
    // publicPath: 'http://www.daviepoplarcapital.com/'
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/i,
        exclude: /node_modules/,
        loader: 'babel'
      }, {
        test: /\.scss$/i,
        loaders: [
          'style-loader',
          'css-loader',
          'postcss-loader',
          'sass-loader?outputStyle=expanded'
          // 'autoprefixer?browsers=last 3 versions',
        ]
      }, { 
        test: /\.json$/i, 
        loader: 'json'
      }, {
        test: /\.(pdf|vcf|docx?)$/i,
        loader: 'file-loader?name=/resources/[name].[ext]'
      }, {
        // test: /\.(jpe?g|png|gif|svg|woff2?|eot|ttf)(?.*$|$)?/i,
        test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/i,
        loader: 'url?limit=100000&name=[name].[ext]'
        // loader: 'file-loader?name=/images/[name].[ext]'
      }
    ]
  },
  watch: true,
  devtool: 'cheap-eval-source-map',
  devServer: {
    // contentBase: './public',
    inline: true,
    port: 8100
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        'NODE_ENV': JSON.stringify('production')
      }
    }),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.AggressiveMergingPlugin()
  ],
  stats: {
    colors: true,
    modules: true,
    reasons: true,
    errorDetails: true
  },
  resolve: {
    extensions: ['', '.js', '.jsx']
  }
};


/*
module.exports = {
  devtool: 'cheap-eval-source-map',
  entry: [
    path.join(__dirname, './app/app.js')
    // path.join(__dirname, './app/app.js')
  ],
  output: {
    path: path.join(__dirname, 'public'),
    filename: './js/bundle.js',
    publicPath: 'http://www.daviepoplarcapital.com/'
    // sourceMapFilename: "public/js/bundle.map"
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/i,
        exclude: /node_modules/,
        loaders: ['babel']
      }
      // , {
      //   test: /\.(jpe?g|png|gif|svg)$/i,
      //   loader: 'file-loader?name=/images/[name].[ext]'
      // }, {
      //   test: /\.pdf/i,
      //   loader: 'file-loader?name=/docs/[name].[ext]'
      // }
    ]
  },
  devServer: {
    colors: true,
    contentBase: __dirname,
    noInfo: false,
    hot: true,
    inline: true,
    port: 3000,
    host: 'localhost'
  },
  plugins: []
};
*/

@@ -128,16 +128,17 @@
 /Main.js
+x
 ')%0A  %5D,%0A
@@ -188,18 +188,20 @@
 'public/
-js
+dist
 '),%0A    
@@ -792,110 +792,147 @@
 ame=
-/resources/%5Bname%5D.%5Bext%5D'%0A      %7D, %7B%0A        // test: /%5C.(jpe?g%7Cpng%7Cgif%7Csvg%7Cwoff2?%7Ceot%7Cttf)(?.*$%7C$)?/i,
+%5Bname%5D.%5Bext%5D&publicPath=public/resources/&outputPath=public/dist/'%0A        // loader: 'file-loader?name=/resources/%5Bname%5D.%5Bext%5D'%0A      %7D, %7B
 %0A   
@@ -1690,899 +1690,4 @@
 %0A%7D;%0A
-%0A%0A/*%0Amodule.exports = %7B%0A  devtool: 'cheap-eval-source-map',%0A  entry: %5B%0A    path.join(__dirname, './app/app.js')%0A    // path.join(__dirname, './app/app.js')%0A  %5D,%0A  output: %7B%0A    path: path.join(__dirname, 'public'),%0A    filename: './js/bundle.js',%0A    publicPath: 'http://www.daviepoplarcapital.com/'%0A    // sourceMapFilename: %22public/js/bundle.map%22%0A  %7D,%0A  module: %7B%0A    loaders: %5B%0A      %7B%0A        test: /%5C.jsx?$/i,%0A        exclude: /node_modules/,%0A        loaders: %5B'babel'%5D%0A      %7D%0A      // , %7B%0A      //   test: /%5C.(jpe?g%7Cpng%7Cgif%7Csvg)$/i,%0A      //   loader: 'file-loader?name=/images/%5Bname%5D.%5Bext%5D'%0A      // %7D, %7B%0A      //   test: /%5C.pdf/i,%0A      //   loader: 'file-loader?name=/docs/%5Bname%5D.%5Bext%5D'%0A      // %7D%0A    %5D%0A  %7D,%0A  devServer: %7B%0A    colors: true,%0A    contentBase: __dirname,%0A    noInfo: false,%0A    hot: true,%0A    inline: true,%0A    port: 3000,%0A    host: 'localhost'%0A  %7D,%0A  plugins: %5B%5D%0A%7D;%0A*/%0A

Modify to use file-loader for vCard resources