Skip to content

Commit 6e89f5c

Browse files
committed
frontend/web: compile using relative base path instead of absolute
The default value for `base` is `/`, resulting in ``` <script type="module" crossorigin src="/assets/index-98aa38f3.js"></script> <link rel="stylesheet" href="/assets/index-f26e81d9.css"> ``` in `frontends/web/build/index.html`. For embedded use, the vite docs recommend using a relative path: ``` <script type="module" crossorigin src="./assets/index-98aa38f3.js"></script> <link rel="stylesheet" href="./assets/index-f26e81d9.css"> ``` For Qt and Android, this does not seem to make a difference. On iOS however, the way that local assets are looked up, it has to be relative.
1 parent 5657567 commit 6e89f5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

frontends/web/vite.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import checker from 'vite-plugin-checker';
55

66
export default defineConfig(() => {
77
return {
8+
// Relative base path so the js/css files are referenced with `./index-...js` instead of
9+
// `/index-...js`. This makes it easier to find these files in iOS.
10+
base: './',
811
build: {
912
modulePreload: false,
1013
outDir: 'build',

0 commit comments

Comments
 (0)