electronshoppinglist
electronshoppinglist copied to clipboard
addWindow.html: require is not defined
Hi Brad, First of all thank you for your awesome course!
Currently when we click on add item
button on add window we get an error as require is not defined
.
Robb and Israel had proposed a solution in your video to enable nodeIntegration
in browserWindow
with a parameter as:
new BrowserWindow(
{
webPreferences: {
nodeIntegration: true
}
}
)
Adding this as an issue for tracking. :)
Thank for the note @forcetrekker !!
Hi guys, based on https://www.electronjs.org/docs/tutorial/security It is not appropriate to use the above solution, so is there any other alternative solution?
Hi, facing the same issue: Uncaught ReferenceError: require is not defined Added the require.js file: https://requirejs.org/docs/release/2.3.6/minified/require.js in the main project directory and referenced it in addWindow.html as such:
Still issue not resolved. Any help will be appreciated, thanks!
@gauravjoshi1998 starting the version 12 of electron you must to pass the following props webPreferences: { nodeIntegration: true, contextIsolation: false, }
when you create instance of BrowserWindow
Hi guys, based on https://www.electronjs.org/docs/tutorial/security It is not appropriate to use the above solution, so is there any other alternative solution?
With my current understanding of the security documentation, the security issues arise when using content from external sources as mentioned here https://www.electronjs.org/docs/tutorial/security, "A security issue exists whenever you receive code from an untrusted source (e.g. a remote server)". So in this use case, this isn't causing security issues as log as we don't use any untrusted external sources.