title: Electron & ES6 how to implement require remote/ipc when using gulp and ES6 modules
body: <p>i am using ES6 js files that are then compiled by gulp (browserify/babel), example of a ES6 file is:</p>
  
  <p>I have a normal App.js that is used to set up the main window etc.. Then the html pages will use a main.min.js file that is basically made up with all my ES6 classes compiled into one file:</p>
  
  <p>loader.es6 file</p>
  
  <pre><code>import Main from  './pages/Main.es6'
  
  new Main()
  </code></pre>
  
  <p>Main.es6 file</p>
  
  <pre><code> import Vue from 'vue';
  
  export default class Main extends Vue{
     constructor() {...}
     .....
  }
  </code></pre>
  
  <p>When compiled and run this all works fine and all is good... But as i thought if i want to implement the 'IPC', 'Remote' modules, i am having issues with compiling as they cannot find those modules, either through the <code>require()</code> or  <code>import..</code> methods within my classes.</p>
  
  <p>so doing the following fails:</p>
  
  <pre><code> import Remote from 'remote'
   import Main from  './pages/Main.es6'
  
   new Main()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>var Remote = require('remote')
  import Main from  './pages/Main.es6'
  
  new Main()
  </code></pre>
  
  <p>Is this possible to do or achieve, or nope needs more thought and going back to normal js please.</p>
  
  <p>Any ideas / advice would be great thanks</p>
  
  <p>EDIT: add the error details</p>
  
  <p>An example file in question <a href="https://github.com/simondavies/electron-vuejs-starter/blob/develop/resources/js/pages/Main.es6">Main.es6</a></p>
  
  <p>see the added var <code>var Remote = require('remote')</code>at the top this causes the following error.</p>
  
  <p>even using <code>import Remote from 'remote'</code></p>
  
  <pre><code>{ [Error: Cannot find module 'remote' from '/Volumes/DAVIES/ElectronApps/electron-vuejs-starter/resources/js/pages']
   stream:
    { _readableState:
    { highWaterMark: 16,
      buffer: [],
      length: 0,
      pipes: [Object],
      pipesCount: 1,
      flowing: true,
      ended: false,
      endEmitted: false,
      reading: true,
      sync: false,
      needReadable: true,
      emittedReadable: false,
      readableListening: false,
      objectMode: true,
      defaultEncoding: 'utf8',
      ranOut: false,
      awaitDrain: 0,
      readingMore: false,
      decoder: null,
      encoding: null,
      resumeScheduled: false },
     readable: true,
     domain: null,
     _events:
    { end: [Object],
      error: [Object],
      data: [Function: ondata],
      _mutate: [Object] },
    _maxListeners: undefined,
    _writableState:
     { highWaterMark: 16,
      objectMode: true,
      needDrain: false,
      ending: true,
      ended: true,
      finished: true,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function],
      writecb: null,
      writelen: 0,
      buffer: [],
      pendingcb: 0,
      prefinished: true,
      errorEmitted: false },
    writable: true,
    allowHalfOpen: true,
    _options: { objectMode: true },
    _wrapOptions: { objectMode: true },
     _streams: [ [Object] ],
    length: 1,
     label: 'deps' } }
  </code></pre>