How do I use blazor server-side inside a razor component library using areas?

Hey we also found ourself with the same issue. A better solution would be to specify <base href="~/"/> in the head of the html and just referencing <script src="_framework/blazor.server.js"/>

so

<html>
<head>
<base href="~/"/>
</head>
<body>

<script src="_framework/blazor.server.js"/>
</body>
</html>

After digging though both signalR documentation and the blazor.server.js file I was able to come up with a solution. Adding the code below to you're layout file configures the signalR hub to use an absolute path instead of a relative path.

<script src="~/_framework/blazor.server.js" autostart="false"></script>
<script>
    Blazor.start({
        configureSignalR: function (builder) {
            builder.withUrl("/_blazor");
        }
    });
</script>

This allows razor components to be used directly in a razor class library, using area routing.