Skip to content

Not work with .net 8.0 blazor web project #926

Closed

Description

@mafei1982
  • Version:
    0.1.0
  • Target:

Steps to Reproduce:

  1. Just create a blazor web project (.net 8+) with sample weather code. And follow your instructions to enable electronnet
Image
  1. press F5, and open dev tools and you will see:
Image The blazor related js cannot work properly

Activity

  1. FlorianRappl commented on Nov 14, 2025

    @FlorianRappl
    Collaborator

    I got it working pretty much out of the box. There is just two things:

    1. See Blazor Web App (.net8) - error: Cannot resolve '_blazor' when started by - electronize start #823 - you'll need to "tell" Blazor it's still in a browser. As the heuristic is pretty bad, it thinks its running in Node.js.
    2. The HMR does not work with a weird message that jQuery is not loaded - my best guess is that VS does not inject the required code.

    I think we can improve (1) to the point that there is a property "AllowBlazor" or "IsBlazorProcess" (or similar). When this property is set we introduce a preload script that will set process to undefined, leading to Blazor as it should.

    For (2) I am still looking why exactly we run into this and what we can do to improve it. Will be also coming in.

  2. added this to the 0.2.0 milestone on Nov 14, 2025
  3. FlorianRappl commented on Nov 14, 2025

    @FlorianRappl
    Collaborator

    Yeah I can make (2) also work like (1) - reason was that jQuery (which is part of browserLink) has a check to detect if its running in a CJS system. As module is also defined by Electron this was not working. Essentially same fix -> global.process = undefined; global.module = undefined.

  4. FlorianRappl commented on Nov 14, 2025

    @FlorianRappl
    Collaborator

    Rolled out 0.2.0-pre.200:

    builder.UseElectron(args, async () =>
    {
        var browserWindow = await Electron.WindowManager.CreateWindowAsync(
            new BrowserWindowOptions { Show = false, AutoHideMenuBar = true, IsRunningBlazor = false });
    
        browserWindow.OnReadyToShow += () => browserWindow.Show();
    });

    Release ETA is Monday.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions