More bundling improvements

This commit is contained in:
Contreras, Raf 2023-12-24 16:14:34 +13:00
parent bbf5645c2b
commit 68538d2112

View file

@ -11,6 +11,15 @@ import { loadEnv, splitVendorChunkPlugin } from "vite";
import tailwind from "tailwindcss";
import rtl from "postcss-rtlcss";
const captioningPackages = [
"dompurify",
"htmlparser2",
"subsrt-ts",
"parse5",
"entities",
"fuse"
];
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
return {
@ -119,8 +128,18 @@ export default defineConfig(({ mode }) => {
if (id.includes("hls.js")) {
return "hls";
}
if (id.includes("node-forge")) {
return "node-forge";
if (id.includes("node-forge") || id.includes("crypto-js")) {
return "auth";
}
if (id.includes("locales") && !id.includes("en.json")) {
return "locales";
}
if (id.includes("Icon.tsx")) {
return "Icons";
}
const isCaptioningPackage = captioningPackages.some(packageName => id.includes(packageName));
if (isCaptioningPackage) {
return "caption-parsing";
}
}
}