IO-2935 improve chunking for vite build.

This commit is contained in:
Patrick Fic
2024-09-25 11:59:33 -07:00
parent 45a9e37342
commit 7094b6ffbf

View File

@@ -9,6 +9,7 @@ import eslint from "vite-plugin-eslint";
import { VitePWA } from "vite-plugin-pwa";
import InstanceRenderManager from "./src/utils/instanceRenderMgr";
import chalk from "chalk";
//import { visualizer } from "rollup-plugin-visualizer";
process.env.VITE_APP_GIT_SHA_DATE = new Date().toLocaleString("en-US", {
timeZone: "America/Los_Angeles"
@@ -46,6 +47,7 @@ export const logger = createLogger("info", {
export default defineConfig({
base: "/",
plugins: [
visualizer(),
ViteEjsPlugin((viteConfig) => ({ env: viteConfig.env })),
VitePWA({
injectRegister: "auto",
@@ -182,11 +184,45 @@ export default defineConfig({
},
build: {
rollupOptions: {
external: [
"react",
"firebase",
"firebase/app",
"firebase/firestore",
"firebase/firestore/lite",
"firebase/auth",
"firebase/functions",
"firebase/storage",
"firebase/database",
"firebase/remote-config",
"firebase/performance",
"@firebase/app",
"@firebase/firestore",
"@firebase/firestore/lite",
"@firebase/auth",
"@firebase/functions",
"@firebase/storage",
"@firebase/database",
"@firebase/remote-config",
"@firebase/performance",
"lodash",
"antd",
"react-redux",
"@splitsoftware/splitio-react",
"@sentry/react",
"logrocket",
"markerjs2",
"@apollo/client",
"libphonenumber-js"
],
output: {
manualChunks: {
antd: ["antd"],
"react-redux": ["react-redux"],
redux: ["redux"]
// antd: ["antd"],
// "react-redux": ["react-redux"],
// redux: ["redux"],
// lodash: ["lodash"],
// "@sentry/react": ["@sentry/react"],
// //"@splitsoftware": ["@splitsoftware"]
}
}
}
@@ -196,6 +232,8 @@ export default defineConfig({
"react",
"react-dom",
"antd",
"lodash",
"@sentry/react",
"@apollo/client",
"@reduxjs/toolkit",
"axios",