You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can work around this for the dev-server by adding target: ['web', 'electron-renderer'] to your renderer webpack config, but it doesn't fix It for production builds:
Steps to reproduce
Create a new electron app using the typescript-webpack plugin. npx create-electron-app my-new-app --template=typescript-webpack
Add webPreferences: { nodeIntegration: true } to the new BrowserWindow call in index.ts
Add nodeIntegration: true to the forge config in the package.json.
Start the new app, observe the error.
As mentioned above, you can work around this for the dev-server by adding target: ['web', 'electron-renderer'] to your renderer webpack config, but it doesn't fix It for production builds.
To fully fix this, you need to set contextIsolation: false in the new BrowserWindow call in index.ts which is not ideal.
Found this bug also. If someone does not want to open { nodeIntegration: true }, another workaround is to get the page url from ipcMain side by adding an ipcMain handle method to return the page urls.
but I think it is still a bug that needs to be fixed.
Pre-flight checklist
Electron Forge version
6.0.0-beta.61
Electron version
v16.0.0
Operating system
macOS 12.0.1
Last known working Electron Forge version
N/A
Expected behavior
Electron Forge should not depend on node's
require
unless bothnodeIntegration: true
andcontextIsolation: false
.Actual behavior
Electron Forge throws an error in the dev-server when you attempt to use
nodeIntegration
as described here: https://www.electronforge.io/config/plugins/webpack#node-integrationYou can work around this for the dev-server by adding
target: ['web', 'electron-renderer']
to your renderer webpack config, but it doesn't fix It for production builds:Steps to reproduce
npx create-electron-app my-new-app --template=typescript-webpack
webPreferences: { nodeIntegration: true }
to thenew BrowserWindow
call inindex.ts
nodeIntegration: true
to the forge config in the package.json.As mentioned above, you can work around this for the dev-server by adding
target: ['web', 'electron-renderer']
to your renderer webpack config, but it doesn't fix It for production builds.To fully fix this, you need to set
contextIsolation: false
in thenew BrowserWindow
call inindex.ts
which is not ideal.Additional information
This may be a bug in vercel/webpack-asset-relocator-loader and not Electron Forge, but it should at least be documented.
The text was updated successfully, but these errors were encountered: