Skip to content

Commit 6a2982a

Browse files
authored
Fix the import for apps with a base path (#3092)
1 parent c85c478 commit 6a2982a

File tree

12 files changed

+43
-19
lines changed

12 files changed

+43
-19
lines changed

samples/Basic/BlazorWebAssembly/SkiaSharpSample/Properties/launchSettings.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@
2020
"environmentVariables": {
2121
"ASPNETCORE_ENVIRONMENT": "Development"
2222
}
23+
},
24+
// Uncomment the <base> element in index.html to use these profiles
25+
"http/app": {
26+
"commandName": "Project",
27+
"dotnetRunMessages": true,
28+
"launchBrowser": true,
29+
"launchUrl": "app",
30+
"commandLineArgs": "--pathbase=/app",
31+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/app/_framework/debug/ws-proxy?browser={browserInspectUri}",
32+
"applicationUrl": "http://localhost:5000",
33+
"environmentVariables": {
34+
"ASPNETCORE_ENVIRONMENT": "Development"
35+
}
36+
},
37+
"https/app": {
38+
"commandName": "Project",
39+
"dotnetRunMessages": true,
40+
"launchBrowser": true,
41+
"launchUrl": "app",
42+
"commandLineArgs": "--pathbase=/app",
43+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/app/_framework/debug/ws-proxy?browser={browserInspectUri}",
44+
"applicationUrl": "https://localhost:5001;http://localhost:5000",
45+
"environmentVariables": {
46+
"ASPNETCORE_ENVIRONMENT": "Development"
47+
}
2348
}
2449
}
2550
}

samples/Basic/BlazorWebAssembly/SkiaSharpSample/wwwroot/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<meta charset="utf-8" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>SkiaSharpSample</title>
8-
<base href="/" />
8+
<!-- <base href="/" /> -->
9+
<base href="/app/" />
910
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
1011
<link rel="stylesheet" href="css/app.css" />
1112
<link rel="icon" type="image/png" href="favicon.ico" />

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/Internal/JSModuleInterop.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal partial class JSModuleInterop : IDisposable
2020
public JSModuleInterop(IJSRuntime js, string moduleName, string moduleUrl)
2121
{
2222
#if NET7_0_OR_GREATER
23-
moduleTask = JSHost.ImportAsync(moduleName, "/" + moduleUrl);
23+
moduleTask = JSHost.ImportAsync(moduleName, "../" + moduleUrl);
2424
#else
2525
if (js is not IJSInProcessRuntime)
2626
throw new NotSupportedException("SkiaSharp currently only works on Web Assembly.");

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/SkiaSharp.Views.Blazor.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
<PackageTags>aspnet;blazor;web</PackageTags>
1313
</PropertyGroup>
1414

15+
<PropertyGroup>
16+
<TypeScriptTarget>es2015</TypeScriptTarget>
17+
<TypeScriptModuleKind>es2015</TypeScriptModuleKind>
18+
<TypeScriptNoImplicitAny>True</TypeScriptNoImplicitAny>
19+
</PropertyGroup>
20+
1521
<ItemGroup>
1622
<SupportedPlatform Include="browser" />
1723
</ItemGroup>
@@ -21,7 +27,7 @@
2127
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.0" Condition="$(TargetFramework.StartsWith('net7.0'))" />
2228
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" Condition="$(TargetFramework.StartsWith('net8.0'))" />
2329
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" Condition="$(TargetFramework.StartsWith('net9.0'))" />
24-
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.5.3" PrivateAssets="all" />
30+
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.7.1" PrivateAssets="all" />
2531
</ItemGroup>
2632

2733
<ItemGroup>

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/tsconfig.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/wwwroot/DpiWatcher.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/wwwroot/DpiWatcher.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/wwwroot/SKHtmlCanvas.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/wwwroot/SKHtmlCanvas.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/SkiaSharp.Views/SkiaSharp.Views.Blazor/wwwroot/SizeWatcher.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)