title: Cookies module not working in Electron app
body: <p>I am trying to return the cookies from the browser header but I cannot even get the module to work. I can run the app but I am getting error message: <a href="http://i.stack.imgur.com/cvEYo.png" rel="nofollow">Error Alert</a>. I'm using Node.JS with Electron + Webpack + React. This is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = require('app');
  var BrowserWindow = require('browser-window');
  var http = require('http');
  var Cookies = require('./node_modules/cookies');
  require('crash-reporter').start();
  
  app.on('window-all-closed', function() {
    if (process.platform != 'darwin') {
      app.quit();
    }
  });
  
  app.on('ready', function() {
    mainWindow = new BrowserWindow({
     frame: true,
     width: 1200,
     resizable: false,
     height: 800,
      'web-preferences': {'web-security': false}});
    
    mainWindow.setMenu(null);
  
    mainWindow.loadUrl('file://' + __dirname + '/public/index.html');
  
    mainWindow.openDevTools();
  
    mainWindow.on('closed', function() {
      mainWindow = null;
    });
    
    mainWindow.on.session.Cookies.get({}, function(error, Cookies) {
      if (error) throw error;
      console.log(Cookies);
    });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Package.json:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>{
    "name": "BSB-app",
    "version": "0.1.0",
    "description": "",
    "main": "main.js",
    "devDependencies": {
      "babel": "^6.5.2",
      "babel-cli": "^6.6.0",
      "babel-core": "^6.5.2",
      "babel-loader": "^6.2.3",
      "babel-preset-es2015": "^6.6.0",
      "babel-preset-react": "^6.5.0",
      "babel-register": "^6.6.0",
      "css-loader": "^0.23.1",
      "electron-cookies": "^1.1.0",
      "electron-packager": "^5.2.1",
      "electron-rebuild": "^1.1.3",
      "less": "^2.6.0",
      "less-loader": "^2.2.2",
      "node-libs-browser": "^1.0.0",
      "style-loader": "^0.13.0",
      "webpack": "^1.12.14",
      "webpack-dev-server": "^1.14.1"
    },
    "dependencies": {
      "babel-polyfill": "^6.6.1",
      "electron-prebuilt": "^0.36.8",
      "exports-loader": "^0.6.3",
      "imports-loader": "^0.6.5",
      "react": "^0.14.7",
      "react-dom": "^0.14.7",
      "react-redux": "^4.4.0",
      "redux": "^3.3.1",
      "whatwg-fetch": "^0.11.0"
    },
    "scripts": {
      "start": "electron .",
      "watch": "node_modules/.bin/webpack-dev-server",
      "electron-rebuild": "node_modules/.bin/electron-rebuild"
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Webpack.config.js:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const webpack = require('webpack');
  
  const production = process.env.NODE_ENV === 'production';
  
  module.exports = {
    entry: { 
      app: ['webpack/hot/dev-server', './javascripts/entry.js']
    },
  
    output: {
      path: './public/built',
      filename: 'bundle.js',
      publicPath: 'http://localhost:8080/built/'
    },
  
    devServer: {
      contentBase: './public',
      publicPath: 'http://localhost:8080/built/'
    },
    resolveLoader: {
        modulesDirectories: [
            'node_modules'
        ]
   },
    module: {
      loaders: [
        { test: /\.jsx?$/, loader: 'babel-loader', query: { presets: ['es2015', 'react'] }, exclude: /node_modules/ },
        { test: /\.css$/, loader: 'style-loader!css-loader' },
        { test: /\.less$/, loader: 'style-loader!css-loader!less-loader'},
      ]
    },
  
    plugins: [
      new webpack.HotModuleReplacementPlugin(),
      new webpack.DefinePlugin({
        'process.env': {NODE_ENV: JSON.stringify(process.env.NODE_ENV)},
      }),
      new webpack.ProvidePlugin({
      'fetch': 'imports?this=&gt;global!exports?global.fetch!whatwg-fetch'
    }),
     new webpack.IgnorePlugin(new RegExp("^(fs|ipc)$"))
    ]
  }</code></pre>
  </div>
  </div>
  </p>