Skip to content

Instantly share code, notes, and snippets.

@albertogalca
Last active April 9, 2020 10:36
Show Gist options
  • Save albertogalca/bf902f5fd62593863af92b6c8c7e61fa to your computer and use it in GitHub Desktop.
Save albertogalca/bf902f5fd62593863af92b6c8c7e61fa to your computer and use it in GitHub Desktop.
Using Node.js funtionalities with CRA and Electron without ejecting Webpack
// Install craco package https://www.npmjs.com/package/@craco/craco and create a craco.config.js with the following configuration
module.exports = {
webpack: {
configure: {
target: "electron-renderer",
},
},
};
// Add nodeIntegration option inside your BrowserWindow configuration
new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment