Last active
April 9, 2020 10:36
-
-
Save albertogalca/bf902f5fd62593863af92b6c8c7e61fa to your computer and use it in GitHub Desktop.
Using Node.js funtionalities with CRA and Electron without ejecting Webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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", | |
}, | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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