last day (15 days later) » 

10:43
0
A: Electron main.js NODE_ENV is not available

mklimekTry to read mode through process.env.WEBPACK_MODE. In your case: const isDevelopement = (process.env.WEBPACK_MODE === "development"); Another, workaround solution using WebpackDefinePlugin: const mode = 'development'; module.exports = merge(common, { mode: mode, plugins: [ new webpa...

using WEBPACK_MODE still results in undefined. If I log the env variabel I also cannot see the WEBPACK_MODE variable in the list of keys.
Try to pass mode as a parameter to webpack: webpack ---mode development
Check out workaround solution as well :)
I just found out I still needed to use the definePlugin, what a coincidence. But I still cannot access this variable in Electron. This still results in undefined :(
TBH, I haven't worked with Electron development environment. Try standard and most simple like SET NODE_ENV=development && webpack ... or EXPORT if you're unix based. Then read process.env.NODE_ENV.
That works, Thanks! But now the question remains, why isn't the NODE_ENV leaked into the scope of electron, where it is available in the scope of the app (Electron is nothing more then a container arround an App, just like Cordova)
10:43
If it works, you can pass it to mode and use WebpackDefinePlugin to make it available across whole app :)
I tried it with the define plugin, but then it is still unavailable
But when I use the SET you added in your answer it works
So what is the difference between the two..
Using SET is explicit setting env var
it must work :)
I (logically) do not want to use 2 places where I set the env variable for my app, but I do not know how I can work arround the 'SET'
To be honest SET or EXPORT is a standard way
It's not workaround
ofc, use only once place :)
Hmm then I guess I would need to use the SET in my npm task and not the defineplugin
10:48
to set the 'development', then only pass it around
Thank you for your help!
accept and upvote the anser please :)\
I will :)
cheers!

last day (15 days later) »