This is a pretty ugly sittuation. It's really a hack around the way @stevekrouse/lucia_middlware was written, but to make it safe to import on the frontend, because it only imports the backend stuff dynamically per request.
https://esm.town/v/stevekrouse/lucia_middleware_safe
<script type="module" src="https://esm.town/v/stevekrouse/lucia_middleware_safe"></script>