Skip to content

Publishing a blazor wasm, that is served from a backend (through project include), does not populate the importmap #64709

@sleepwalkerffs

Description

@sleepwalkerffs

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

There is a minimal repo here: minimal-repo.zip
If you navigate into the repo to minimal-repo\WebApplication2 and execute dotnet publish .\WebApplication2.csproj -c Release you will find the index.html in minimal-repo\WebApplication2\bin\Release\net10.0\publish\wwwroot which contains an empty importmap:
<script type="importmap"></script>
This results in a non working blazor app.

Expected Behavior

The importmap should be populated like this:

<script type="importmap">{
  "imports": {
    "./_framework/blazor.webassembly.js": "./_framework/blazor.webassembly.66stpp682q.js",
    "./_framework/dotnet.js": "./_framework/dotnet.8lbghqbqg3.js",
    "./_framework/dotnet.native.js": "./_framework/dotnet.native.xanz2e7ksm.js",
    "./_framework/dotnet.runtime.js": "./_framework/dotnet.runtime.o0qy896u8v.js"
  },
  "scopes": {},
  "integrity": {
    "./_framework/blazor.webassembly.66stpp682q.js": "sha256-3lCWrko3zwspV40aQhs2S/IMkRSarnHRKIdkHhuXIBA=",
    "./_framework/blazor.webassembly.js": "sha256-3lCWrko3zwspV40aQhs2S/IMkRSarnHRKIdkHhuXIBA=",
    "./_framework/dotnet.8lbghqbqg3.js": "sha256-VNjXDaSOqCze1lQpbXefxCqOiepPF9oGAydILjYgIuM=",
    "./_framework/dotnet.js": "sha256-VNjXDaSOqCze1lQpbXefxCqOiepPF9oGAydILjYgIuM=",
    "./_framework/dotnet.native.js": "sha256-uQpMf2vCY3ZTY+nV2gmp8VdAe67PW6h1gInkE7r/PLY=",
    "./_framework/dotnet.native.xanz2e7ksm.js": "sha256-uQpMf2vCY3ZTY+nV2gmp8VdAe67PW6h1gInkE7r/PLY=",
    "./_framework/dotnet.runtime.js": "sha256-yJvgPPUUvavYVmu9VD/fYtMcoEnLVaB0Cr7JAE29btw=",
    "./_framework/dotnet.runtime.o0qy896u8v.js": "sha256-yJvgPPUUvavYVmu9VD/fYtMcoEnLVaB0Cr7JAE29btw="
  }
}</script>

Actual Behavior

The importmap script tag is empty:

<script type="importmap"></script>

Additional Information

When you publish the Blazor wasm directly by navigatng into minimal-repo/Blazor10 and executing dotnet publish .\Blazor10.csproj -c Release the importmap will get populated as shown above in the Expected Result

.NET Version

10.0.100

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions