Skip to content

[Blazor] Accept the blazor.web.js startup options format in blazor.{server|webassembly}.js #51611

@MackinnonBuck

Description

@MackinnonBuck

Problem

When a Blazor app uses blazor.web.js, the options object passed to Blazor.start() has the following format:

Blazor.start({
  ssr: { /* ... */ },
  circuit: { /* ... */ },
  webAssembly: { /* ... */ },
});

However, when using blazor.server.js or blazor.webassembly.js, runtime-specific options are specified as top-level properties on the options object. So, for example, if you're using blazor.webassembly.js and you attempt to customize the loading of boot resources like this:

Blazor.start({
  webAssembly: {
    loadBootResource: function (/* ... */) {
      // ...
    },
  },
});

...then it will just silently "not work". This could create a pit of failure for customers who see examples in docs using the blazor.web.js options format but are writing a Blazor WebAssembly standalone app, for example.

Solution

We should update blazor.webassembly.js and blazor.server.js to accept the options format used by blazor.web.js.

Summary Comment: #51611 (comment)

Metadata

Metadata

Assignees

Labels

Complexity: SimpleHandling this issue should be relatively simple to tacklePillar: Complete Blazor WebPriority:2Work that is important, but not critical for the releasearea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onegood first issueGood for newcomers.help wantedUp for grabs. We would accept a PR to help resolve this issuetriaged

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions