Skip to content

Commit

Permalink
Merge pull request #2618 from NationalSecurityAgency/t#2490/app_chunks
Browse files Browse the repository at this point in the history
#2490: configured rollup to split js assets into multiple chunks; con…
  • Loading branch information
rmmayo authored Jul 1, 2024
2 parents 9752608 + f723f82 commit dd8313e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dashboard-prime/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ coverage
*.sw?

*.tsbuildinfo

stats.html
1 change: 1 addition & 0 deletions dashboard-prime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"jsdom": "24.0.0",
"license-checker": "25.0.1",
"prettier": "3.2.5",
"rollup-plugin-visualizer": "5.12.0",
"vite": "5.2.12",
"vitest": "1.6.0"
}
Expand Down
37 changes: 37 additions & 0 deletions dashboard-prime/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,36 @@ import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { visualizer } from 'rollup-plugin-visualizer'

// TODO need to add support for PKI mode
const proxyConf = {
target: 'http://localhost:8080',
changeOrigin: true,
};

function getChunkId(id) {
if (id.includes('vis-network')) {
return 'visNetwork';
} else if (id.includes('vue3-apexcharts') || id.includes('apexcharts')) {
return 'apexCharts';
} else if (id.includes('@toast-ui/editor') || id.includes('toastui-editor-viewer')) {
return 'toastUI';
} else if (id.includes('node-emoji')) {
return 'nodeEmoji';
} else if (id.includes('primevue/datatable')) {
return 'primevueDatatable';
} else if (id.includes('primevue/calendar')) {
return 'primevueCalendar';
} else if (id.includes('primevue/')) {
return 'primevueComponents';
} else if (id.includes('@skilltree/skills-client-js')) {
return 'skillClient';
} else if (id.includes('skills-display/')) {
return 'skillsDisplay';
}
}

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
Expand Down Expand Up @@ -66,5 +89,19 @@ export default defineConfig({
ws: true,
},
},
},
build: {
chunkSizeWarningLimit: 1200,
rollupOptions: {
output: {
manualChunks: getChunkId
},
plugins: [
visualizer({
open: false,
}),
]
}
}
})

0 comments on commit dd8313e

Please sign in to comment.