From 0d1eb9c7275165b88db8928f121cde18a27476db Mon Sep 17 00:00:00 2001 From: nicholas-codecov Date: Thu, 14 Nov 2024 10:19:10 -0400 Subject: [PATCH 1/2] vendor split popular packages --- vite.config.mjs | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/vite.config.mjs b/vite.config.mjs index 6b8edc97d9..5d0b6e2d6c 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -68,6 +68,31 @@ export default defineConfig((config) => { entryFileNames: 'assets/[name].[hash:22].js', chunkFileNames: 'assets/[name].[hash:22].js', assetFileNames: 'assets/[name].[hash:22][extname]', + manualChunks: { + vendor_react: ['react', 'react-dom', 'react/jsx-runtime'], + vendor_react_router: [ + 'react-router', + 'react-router-dom', + 'react-router-dom-v5-compat', + ], + vendor_date_fns: ['date-fns'], + vendor_lodash: [ + 'lodash/get', + 'lodash/isEqual', + 'lodash/isNull', + 'lodash/isNil', + 'lodash/isEmpty', + 'lodash/isString', + 'lodash/isNumber', + 'lodash/isBoolean', + 'lodash/isUndefined', + 'lodash/isArray', + 'lodash/gt', + 'lodash/omit', + 'lodash/flatMap', + 'lodash/groupBy', + ], + }, }, }, }, @@ -78,12 +103,12 @@ export default defineConfig((config) => { REACT_APP_PENDO_KEY: process.env.REACT_APP_PENDO_KEY, }), tsconfigPaths(), - legacy({ - // which legacy browsers to support - targets: ['>0.2%', 'not dead', 'not op_mini all'], - // which polyfills to include in the modern build - modernPolyfills: ['es.promise.all-settled'], - }), + // legacy({ + // // which legacy browsers to support + // targets: ['>0.2%', 'not dead', 'not op_mini all'], + // // which polyfills to include in the modern build + // modernPolyfills: ['es.promise.all-settled'], + // }), react(), svgr(), ...plugins, From d1ea6c279c14de35c55740a6f37ac442e9c4e3c6 Mon Sep 17 00:00:00 2001 From: nicholas-codecov Date: Thu, 14 Nov 2024 10:22:23 -0400 Subject: [PATCH 2/2] output legacy bundle --- vite.config.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vite.config.mjs b/vite.config.mjs index 5d0b6e2d6c..87a2fd124d 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -103,12 +103,12 @@ export default defineConfig((config) => { REACT_APP_PENDO_KEY: process.env.REACT_APP_PENDO_KEY, }), tsconfigPaths(), - // legacy({ - // // which legacy browsers to support - // targets: ['>0.2%', 'not dead', 'not op_mini all'], - // // which polyfills to include in the modern build - // modernPolyfills: ['es.promise.all-settled'], - // }), + legacy({ + // which legacy browsers to support + targets: ['>0.2%', 'not dead', 'not op_mini all'], + // which polyfills to include in the modern build + modernPolyfills: ['es.promise.all-settled'], + }), react(), svgr(), ...plugins,