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
This commit is contained in:
schroda
2026-05-02 17:04:43 +02:00
parent 5f7b18cf9a
commit 515c402aca
2 changed files with 9 additions and 1 deletions

View File

@@ -1,7 +1,6 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<base href="/" />
<title>Suwayomi</title> <title>Suwayomi</title>
<meta name="apple-mobile-web-app-title" content="Suwayomi" /> <meta name="apple-mobile-web-app-title" content="Suwayomi" />
<meta name="description" content="A manga reader that runs tachiyomi's extensions" /> <meta name="description" content="A manga reader that runs tachiyomi's extensions" />

View File

@@ -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: '/' } }] };
},
},
], ],
})); }));