refac: load jQuery + Bootstrap as global scripts in _Layout

JQuery, jQuery UI, Bootstrap, jquery-validation and
jquery-validation-unobtrusive are now loaded as separate
<script> tags by _Layout.cshtml, BEFORE the core bundle.

Why: esbuild IIFE bundles do not expose jQuery ($ and jQuery)
on window — UMD-style modules bundled in IIFE format are wrapped
in a closure. The application code (site.js, md-helpers.js,
yavsc-remote-fs.js, etc.) consumes window.$ / window.jQuery, so
it broke at runtime. Loading these scripts as global <script> tags
restores the expected global exposure.

This commit only touches the layout. Future commits will remove
the corresponding imports from each bundle's entry (chat, dropzone,
datetime, timepicker) and let them rely on window.$ being already
defined by the layout.

Tested: dotnet test 11/11 green. The new global scripts are
served by ASP.NET static files (HTTP 200 verified). Server
restart by developer required to pick up the new layout.
This commit is contained in:
Paul Schneider 2026-06-14 15:16:16 +01:00
commit 417abcfb71
2 changed files with 34 additions and 15 deletions

View file

@ -7,9 +7,17 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<link rel="icon" type="image/svg+xml" href="~/images/yavsc-logo.svg" asp-append-version="true" />
<link rel="alternate icon" type="image/x-icon" href="@SiteSettings.Value.FavIcon" asp-append-version="true" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/bootstrap.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/jquery-ui.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/site.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/bootstrap.min.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/jquery-ui.min.css" asp-append-version="true"/>
<!-- Vendor scripts: jQuery first, everything else depends on it.
Loaded as global <script> tags (not bundled) so they are
exposed on window as $ / jQuery for the application code. -->
<script src="~/js/jquery.min.js" asp-append-version="true"></script>
<script src="~/js/jquery-ui.min.js" asp-append-version="true"></script>
<script src="~/js/bootstrap.bundle.min.js" asp-append-version="true"></script>
<script src="~/js/jquery.validate.min.js" asp-append-version="true"></script>
<script src="~/js/jquery.validate.unobtrusive.min.js" asp-append-version="true"></script>
<script src="~/js/core.bundle.min.js" asp-append-version="true"></script>
@await RenderSectionAsync("header", false)
</head>