Skip to content

Add Documentation for Preload Script#1031

Open
AeonSake wants to merge 4 commits intoElectronNET:developfrom
AeonSake:1028-preload-override
Open

Add Documentation for Preload Script#1031
AeonSake wants to merge 4 commits intoElectronNET:developfrom
AeonSake:1028-preload-override

Conversation

@AeonSake
Copy link

Proposed changes for #1028

Adds a check for a user-defined preload script before manually overriding the path when running in Blazor-mode. This is technically a breaking change (since the behavior has changed) as preload scripts are now always executed. However, this most likely has no impact on existing applications as they would not have worked before this change anyway (i.e., when using a preload script in Blazor-mode).


if (options.isRunningBlazor) {
options.webPreferences["preload"] = path.join(
if (options.isRunningBlazor && !options.webPreferences.preload) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not make sense as isRunningBlazor only exists for this.

The warning should be printed that a preload script will be ignored if isRunningBlazor is set. The option, which has been turned on explicitly, should always have preference.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me, I'll update the note in the documentation to reflect this.

@AeonSake
Copy link
Author

This PR has been modified to only add new documentation to clarify how to handle preload scripts (and a note when using Blazor).

@AeonSake AeonSake changed the title Never Override a User-Defined Preload Script Add Documentation for Preload Script Feb 17, 2026
@softworkz
Copy link
Collaborator

We could make CreateWindowAsync() throw an ArgumentException if IsRunningBlazor is true and Preload is specified.

@github-actions
Copy link

pr-comment: Run #42

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
1400 1238 0 0 0 162 0 3m 5s

🎉 All tests passed!

Github Test Reporter by CTRF 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments