openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
765 stars 374 forks source link

[ENHANCEMENT] Add ability to specify additional ElectronBrowserWindow configuration #1504

Open EliteMasterEric opened 3 years ago

EliteMasterEric commented 3 years ago

As it stands, the configuration for the ElectronBrowserWindow created by lime in ElectronSetup cannot provide certain additional parameters needed by the user.

Notably, additional webPreferences cannot be overridden, meaning that options like contextIsolation: false cannot be provided without modifying lime.

https://github.com/haxelime/lime/blob/c743fe10c404fb73003e24100f319a472cb4203f/templates/electron/haxe/ElectronSetup.hx#L54

An option to provide this, either by a command line option or by a project config, would be useful.

EliteMasterEric commented 3 years ago

CC @TamarCurry has been experiencing issues related to this.

player-03 commented 3 years ago

Is there any reason you can't use the template feature? Copy ElectronSetup.hx into your project, make the changes you need, and then tell Lime to use your copy:

<template path="my/copy/of/ElectronSetup.hx" rename="haxe/ElectronSetup.hx" />

(Disclaimer: I don't know if the destination path is correct. Check your Export/electron folder to figure out where it really goes.)

TamarCurry commented 3 years ago

Using templates to replace a file might be a solution. However, ElectronSetup.hx already checks compiler values for things like allowHighDPI and stencilBuffer when it sets up the array for windows in lines 12 through 36, so I figure it could at least support compiler values for things like contextIsolation and other properties for the webPreferences properties as well. A comprehensive list of the webPreferences properties can be found here.

EliteMasterEric commented 3 years ago

Is there any reason you can't use the template feature?

This is a very interesting feature. Does this allow you to essentially hotpatch any of your project's dependencies?

I'll look into using it as a fix for my particular use case.