electron-react-typescript-boilerplate
electron-react-typescript-boilerplate copied to clipboard
Calling `child_process` Cannot read property 'NODE_ENV' of undefined
Sorry, new to electron, so I'm probably doing something dumb... but I'm trying to spawn a child process from one of the redux actions just as a test. However, when I add the code:
import { actionCreatorVoid } from './helpers';
import * as process from 'child_process';
export const increment = actionCreatorVoid('INCREMENT_COUNTER');
export const decrement = actionCreatorVoid('DECREMENT_COUNTER');
export function incrementIfOdd() {
return (dispatch: Function, getState: Function) => {
const { counter } = getState();
if (counter % 2 === 0) {
return;
}
var ls = process.spawn('ls');
console.log(ls);
dispatch(increment());
};
}
export function incrementAsync(delay: number = 1000) {
return (dispatch: Function) => {
setTimeout(() => {
dispatch(increment());
}, delay);
};
}
i get the following error:
Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined
I see that NODE_ENV is being set using the define plugin, so IDK if this is a bug or maybe what I'm trying to do isn't possible?
Any Insight would be appreciated! (EG if there is a better way/place to do this).
Did you ever figure this out? I'm having the same issue right now