Skip to content

Commit

Permalink
Fix the Split Chunk functionality + typescript supported version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgrdich committed Apr 22, 2024
1 parent 2a891f8 commit 7e2df92
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 53 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"rimraf": "5.0.5",
"ts-node": "10.9.2",
"ts-prune": "0.10.3",
"typescript": "5.4.5",
"typescript": "5.3.3",
"vite": "5.2.10",
"vite-plugin-checker": "0.6.4",
"vite-plugin-ejs": "1.7.0",
Expand Down
86 changes: 43 additions & 43 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
defineConfig,
loadEnv,
UserConfigExport,
splitVendorChunkPlugin,
} from 'vite';
import { defineConfig, loadEnv, UserConfigExport } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tsconfigPaths from 'vite-tsconfig-paths';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
Expand All @@ -22,7 +17,7 @@ export default defineConfig(({ mode }) => {
}),
];

const prodPlugins = [...defaultPlugins, splitVendorChunkPlugin()];
const prodPlugins = [...defaultPlugins];

const devPlugins = [
...defaultPlugins,
Expand All @@ -42,8 +37,21 @@ export default defineConfig(({ mode }) => {
outDir: 'build',
rollupOptions: {
output: {
manualChunks: {
ace: ['ace-builds', 'react-ace'],
manualChunks(id: string) {
if (id.includes('ace-builds') || id.includes('react-ace')) {
return 'ace';
}

// creating a chunk to react routes deps. Reducing the vendor chunk size
if (
id.includes('react-router-dom') ||
id.includes('@remix-run') ||
id.includes('react-router')
) {
return '@react-router';
}

return null;
},
},
},
Expand Down

0 comments on commit 7e2df92

Please sign in to comment.