From da3705ed20dfe6c661bb4c8e751eb94dd8144273 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Thu, 14 Apr 2022 12:08:53 -0700 Subject: [PATCH] Electron: update to latest version 18 -lib hxnodejs is no longer included in the compilation of ApplicationMain (but it is still included for compilation of ElectronSetup, of course). hxnodejs was removed from ApplicationMain because it forces some require() calls to be included in the generated .js, which would require disabling certain Electron security features to work properly in newer versions of Electron than we targeted previously. Electron's documentation recommends not to do that. To use Node.js APIs, you need to run them in more secure contexts, while communicating over IPC with a "preload script" from the "renderer" process. In Lime/OpenFL, this would require a custom ElectronSetup template override, but that shouldn't be all that surprising. See: https://www.electronjs.org/docs/latest/tutorial/process-model for more details on the Electron side. --- templates/electron/hxml/debug.hxml | 1 - templates/electron/hxml/final.hxml | 1 - templates/electron/hxml/release.hxml | 1 - templates/electron/template/package.json | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/templates/electron/hxml/debug.hxml b/templates/electron/hxml/debug.hxml index 3bedb711b..319c6379d 100644 --- a/templates/electron/hxml/debug.hxml +++ b/templates/electron/hxml/debug.hxml @@ -3,7 +3,6 @@ --next -js ::OUTPUT_FILE:: -cp ::OUTPUT_DIR::/haxe --lib hxnodejs -main ApplicationMain ::HAXE_FLAGS:: -D electron diff --git a/templates/electron/hxml/final.hxml b/templates/electron/hxml/final.hxml index b2b5cebad..6f547bd6f 100644 --- a/templates/electron/hxml/final.hxml +++ b/templates/electron/hxml/final.hxml @@ -3,7 +3,6 @@ --next -js ::OUTPUT_FILE:: -cp ::OUTPUT_DIR::/haxe --lib hxnodejs -main ApplicationMain ::HAXE_FLAGS:: -D electron diff --git a/templates/electron/hxml/release.hxml b/templates/electron/hxml/release.hxml index de2e79414..bce69755e 100644 --- a/templates/electron/hxml/release.hxml +++ b/templates/electron/hxml/release.hxml @@ -3,7 +3,6 @@ --next -js ::OUTPUT_FILE:: -cp ::OUTPUT_DIR::/haxe --lib hxnodejs -main ApplicationMain ::HAXE_FLAGS:: -D electron diff --git a/templates/electron/template/package.json b/templates/electron/template/package.json index 4f6418e2e..69f387626 100644 --- a/templates/electron/template/package.json +++ b/templates/electron/template/package.json @@ -6,6 +6,6 @@ "start": "electron ElectronSetup.js" }, "devDependencies": { - "electron": "^9.1.0" + "electron": "^18.0.4" } }