I use ES6 js files, which are then compiled using gulp (browserify / babel), an example ES6 file:
I have a regular App.js that is used to configure the main window, etc. Then the html pages will use the main.min.js file, which basically consists of all my ES6 classes compiled into a single file:
file loader.es6
import Main from './pages/Main.es6' new Main()
File Main.es6
import Vue from 'vue'; export default class Main extends Vue{ constructor() {...} ..... }
When compiling and starting everything works fine, and everything is fine ... But since I thought that if I want to implement the IPC, 'Remote' modules, I have problems with compilation, since they cannot find these modules, either with of the require() or import.. methods in my classes.
therefore, the following is true:
import Remote from 'remote' import Main from './pages/Main.es6' new Main()
or
var Remote = require('remote') import Main from './pages/Main.es6' new Main()
Is it possible to do this, or is there no need to think more and return to normal js, please.
Any ideas / tips would be greatly appreciated.
EDIT: Add Error Information
Example sample file Main.es6
see the added var var Remote = require('remote') at the top, this causes the following error.
even using import Remote from 'remote'
{ [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' } }