uncaught error require is not defined code example

Example 1: electron Uncaught ReferenceError: require is not defined at recorder.js:1

app.on('ready', () => {
    mainWindow = new BrowserWindow({
        webPreferences: {
            nodeIntegration: true
        }
    });
});

Example 2: postcss TypeError: require is not a function

/* 
    This type of setup worked for me, require calls modified
	to suit my setup.
	You will have to enter the postcss-* pkgs listed in your
	package.json
*/

module.exports = (ctx) => {
  return {
    map: ctx.env === 'development' ? 'inline' : false,
    plugins: [
        require('postcss-csso')()
    ]
  } 
}