Closed thamizh-qwerty closed 1 year ago
@thamizh-qwerty just add (window as any).global = window;
to your polyfills.ts
@thamizh-qwerty just add
(window as any).global = window;
to your polyfills.ts
Used the code in polyfills.ts, error still exists.
@thamizh-qwerty I have no error when I do :
app/main.ts
npm start
npm run electron:build
Changing contextIsolation breaks how electron is injected in the renderer global variable window so isElectron()
function in electron.service.ts
always return false in the default project template.
So context isolation may not be the issue here. Maybe the combinaison of other parameters you changed ? or a 3rd party library you are using on your project ? or the way you have exposed electron API from context bridge ?
Describe the bug I am using Angular and Electron with context isolation enabled in my application. In development mode, everything works fine, but in production mode, I am getting the global is undefined error. I have tried the following solutions without success:
To Reproduce
Expected behavior The application should run without errors in production mode with context isolation enabled.
Screenshots
Additional context
Tried below solutions, none worked. Do you know the fix @maximegris ? https://github.com/webpack/webpack/issues/10035 https://stackoverflow.com/questions/65586906/react-and-electron-with-draft-js-global-is-not-defined/67336441#67336441 https://github.com/facebook/fbjs/issues/290 https://github.com/electron/forge/issues/1498 https://stackoverflow.com/questions/74718063/how-to-enable-context-isolation-in-electron-js-next-js-nextron