From 515c402aca63d5b8c80d549f844590dff1242fde Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 2 May 2026 17:04:43 +0200 Subject: [PATCH] Fix loading vite modern polyfills script The vite legacy plugin injects the modern polyfill script at the start of the header. This is a problem because it will be injected above the base tag, which results in an invalid url and causing the script load to fail --- index.html | 1 - vite.config.ts | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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: '/' } }] }; + }, + }, ], }));