Skip to content

Commit 889b3b7

Browse files
Changed import maps to use ImportMapDefinition and asp-importmap
1 parent 750cc18 commit 889b3b7

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<PackageVersion Include="ContentFeedNuget" Version="$(ToolingPackagesVersion)" />
1717
</ItemGroup>
1818
<ItemGroup>
19+
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="9.0.1" />
1920
<PackageVersion Include="EssentialCSharp.Shared.Models" Version="$(ToolingPackagesVersion)" />
2021
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
2122
<PackageVersion Include="AspNet.Security.OAuth.GitHub" Version="8.3.0" />

EssentialCSharp.Web/EssentialCSharp.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<PackageReference Include="IntelliTect.Multitool" />
1919
<PackageReference Include="Mailjet.Api" />
2020
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" />
21+
<PackageReference Include="Microsoft.AspNetCore.Components" />
2122
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
2223
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" />
2324
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />

EssentialCSharp.Web/Views/Shared/_Layout.cshtml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
@using IntelliTect.Multitool
55
@using EssentialCSharp.Common
66
@inject ISiteMappingService _SiteMappings
7+
@using Microsoft.AspNetCore.Components
8+
@{
9+
var prodMap = new ImportMapDefinition(
10+
new Dictionary<string, string>
11+
{
12+
{ "vue", "./lib/vue/dist/vue.esm-browser.prod.js" },
13+
{ "vue-window-size", "./lib/vue-window-size/composition-api/dist/index.js" },
14+
}, null, null);
15+
var devMap = new ImportMapDefinition(
16+
new Dictionary<string, string>
17+
{
18+
{ "vue", "./lib/vue/dist/vue.esm-browser.js" },
19+
{ "vue-window-size", "./lib/vue-window-size/composition-api/dist/index.js" },
20+
}, null, null);
21+
}
722
<!DOCTYPE html>
823
<html lang="en">
924
<head>
@@ -46,24 +61,10 @@
4661
@*So that Safari can import modules*@
4762
<script async src="/lib/es-module-shims/dist/es-module-shims.js"></script>
4863
<environment include="Development">
49-
<script type="importmap">
50-
{
51-
"imports": {
52-
"vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js",
53-
"vue-window-size": "./lib/vue-window-size/composition-api/dist/index.js"
54-
}
55-
}
56-
</script>
64+
<script type="importmap" asp-importmap="@devMap"></script>
5765
</environment>
5866
<environment exclude="Development">
59-
<script type="importmap">
60-
{
61-
"imports": {
62-
"vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js",
63-
"vue-window-size": "./lib/vue-window-size/composition-api/dist/index.js"
64-
}
65-
}
66-
</script>
67+
<script type="importmap" asp-importmap="@prodMap"></script>
6768
</environment>
6869
<script type="text/javascript">
6970
(function (c, l, a, r, i, t, y) {

EssentialCSharp.Web/wwwroot/js/site.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//import {
2-
// createApp,
3-
// ref,
4-
// reactive,
5-
// onMounted,
6-
// markRaw,
7-
// watch,
8-
// computed,
9-
//} from "vue";
1+
import {
2+
createApp,
3+
ref,
4+
reactive,
5+
onMounted,
6+
markRaw,
7+
watch,
8+
computed,
9+
} from "vue";
1010
import { useWindowSize } from "vue-window-size";
1111

1212
/**

0 commit comments

Comments
 (0)