load js when the app is done loading (#1724)

This commit is contained in:
Athou
2025-03-12 07:33:44 +01:00
parent f620d033b0
commit 7fe004a696
2 changed files with 38 additions and 29 deletions

View File

@@ -8,7 +8,6 @@ import tsconfigPaths from "vite-tsconfig-paths"
// https://vitejs.dev/config/
export default defineConfig(() => ({
plugins: [
customCodeInjector,
react({
babel: {
plugins: ["@lingui/babel-plugin-lingui-macro"],
@@ -57,30 +56,3 @@ export default defineConfig(() => ({
setupFiles: "./src/setupTests.ts",
},
}))
// inject custom js and css links in html
const customCodeInjector: PluginOption = {
name: "customCodeInjector",
transformIndexHtml: html => {
return {
html,
tags: [
{
tag: "script",
attrs: {
src: "custom_js.js",
},
injectTo: "body",
},
{
tag: "link",
attrs: {
rel: "stylesheet",
href: "custom_css.css",
},
injectTo: "head",
},
],
}
},
}