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:
@@ -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" />
|
||||||
|
|||||||
@@ -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: '/' } }] };
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user