reduce dashboard bundle size by lazy loading highlight.js languages (#533)

* lazyload hl.js languages

* pin repository/discord-markdown
This commit is contained in:
repository
2023-03-13 09:13:09 -07:00
committed by GitHub
parent 97be223173
commit 5a248e26a2
13 changed files with 530 additions and 88 deletions

View File

@@ -15,12 +15,15 @@ export default defineConfig({
if (filename.length < 2) return 'index';
else filename = filename[1];
// this is really big and makes the map size go over the sentry file cache limit
if (filename.includes("highlight.js")) return 'vendor-0';
if (filename.startsWith("/highlight.js/es/languages/")) {
const lang = filename.split("/").pop().split(".").shift();
return `vendor_hljs-${lang}`;
}
return 'vendor-1';
// return `vendor-${filename.charCodeAt(1) % 2}`;
}
}
}
}
})