squaremap

squaremap

1.9k Downloads

Relative asset paths break when hosting under a subdirectory like /map

Ajoro opened this issue ยท 0 comments

commented

When running squaremap in external webserver mode, and the site is hosted under a subdirectory (e.g. /map), the generated index.html contains absolute paths to JavaScript and CSS assets. This breaks loading when accessed via a non-root URL, as seen in the screenshot below:

Image

Output in generated HTML:

<script type="module" crossorigin src="/assets/index-DBbLNHyG.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B3PRV0t1.css">

Expected output:

<script type="module" crossorigin src="./assets/index-DBbLNHyG.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-B3PRV0t1.css">

Proposed::
Update vite.config.ts in the web project to include:

base: './'