I'm trying to get my npm start
working for electron.
I know that you usually start a not distributed/packed app with electron .
or ./node_modules/.bin/electron .
. Since I was playing around with NodeJS v8.4.0 together with ES6/7 syntax I did end up with this npm start
script in my package.json:
"scripts": {
"start": "babel-node main.js --presets es2015,stage-3"
}
Everything worked well I was able to use import
for example without any issues. Now I want to use electron together on the fly with this script. I was wondering if that is possible anyhow? I already tried to change my script to this:
"scripts": {
"start": "./node_modules/.bin/electron . babel-node main.js --presets es2015,stage-3"
}
Which gave me a TypeError
for using import
.
Also tried this:
"scripts": {
"start": "babel-node main.js ./node_modules/.bin/electron . --presets es2015,stage-3"
}
This ended up doing nothing...
Without bloating this question any further I've tried already changing alot with no luck.
Is there any possible way to use babel-node main.js --presets es2015,stage-3
to start electron with the given preset so that I can use my syntax without using Gulp
for example to transpile my files?
Alright, I've found a solution. There is a super good helper out there called electron-compile After following the instructions on the github site I can use my
npm start
like this:If electron is installed locally:
If electron is installed globally: