diff --git a/index.html b/index.html
index 50a0e6d5..912683a6 100644
--- a/index.html
+++ b/index.html
@@ -1,7 +1,6 @@
-
Suwayomi
diff --git a/vite.config.ts b/vite.config.ts
index d3cde6cc..f470ca57 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -143,5 +143,14 @@ export default defineConfig(({ command }) => ({
],
},
}),
+ {
+ name: 'inject-base-tag',
+ enforce: 'post',
+ transformIndexHtml() {
+ // Ensure the base tag is placed at the top of the header before any vite injected script
+ // For example, the plugin-legacy injects the modern polyfill script at the top of the header above the base tag, resulting in an invalid url
+ return { tags: [{ tag: 'base', attrs: { href: '/' } }] };
+ },
+ },
],
}));