var path = require('path');
var webpack = require('webpack');
var rev = require('git-rev-sync');

var fs = require('fs');
fs.writeFile("./public/js/version.js", "window.commit="+JSON.stringify({message: rev.message(), hash: rev.long()})+";"); 

module.exports = {
  devtool: 'eval',
  entry: [
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'public/js'),
    filename: 'bundle.js'
  },
  module: {
    loaders: [{
      test: /\.js$/,
      loaders: ['babel'],
      include: path.join(__dirname, 'src')
    }]
  }
};

@@ -59,15 +59,15 @@
 ');%0A
+%0A
 var 
-rev
+fs
  = r
@@ -78,31 +78,275 @@
 re('
-git-rev-sync');%0A%0A
+fs');%0A%0Avar revision = %7Bmessage: %22Failed to retrieve revision%22, hash: %22unknown%22%7D;%0A%0Aif(process.env.HEROKU_SLUG_COMMIT)%7B%0A  console.log(%22Detected Heroku Commit Slug%22);%0A  revision = %7Bmessage: HEROKU_SLUG_DESCRIPTION, hash: process.env.HEROKU_SLUG_COMMIT%7D;%0A%7Delse%7B%0A  
 var 
-fs
+rev
  = r
@@ -353,21 +353,91 @@
 equire('
-fs');
+git-rev-sync');%0A  revision = %7Bmessage: rev.message(), hash: rev.long()%7D;%0A%7D%0A
 %0Afs.writ
@@ -504,50 +504,16 @@
 ify(
-%7Bmessage: rev.message(), hash: rev.long()%7D
+revision
 )+%22;

Support heroku slugs