Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2afdb1e143 | |||
| 1235272161 | |||
| 3526648d1f |
File diff suppressed because one or more lines are too long
@@ -3,6 +3,56 @@ import react from "@vitejs/plugin-react";
|
|||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
|
type ManualChunksFn = (id: string, api: { getModuleIds: () => Iterable<string> }) => string | undefined;
|
||||||
|
|
||||||
|
const manualChunks: ManualChunksFn = (id) => {
|
||||||
|
if (id.includes('node_modules')) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
id.includes('three.') ||
|
||||||
|
id.includes('@react-three') ||
|
||||||
|
id.includes('ol/') ||
|
||||||
|
id.includes('mapbox-gl') ||
|
||||||
|
id.includes('@babel/runtime')
|
||||||
|
) {
|
||||||
|
return 'vendor-3d-maps';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('codemirror') || id.includes('react-codemirror2')) {
|
||||||
|
return 'vendor-codemirror';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('hls.js')) {
|
||||||
|
return 'vendor-hls';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('pixi.js')) {
|
||||||
|
return 'vendor-pixijs';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('@mui/material') || id.includes('@mui/icons-material') || id.includes('@mui/x-data-grid')) {
|
||||||
|
return 'vendor-mui-core';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('/react/') || id.includes('/react-dom/')) {
|
||||||
|
return 'vendor-react-core';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('react-router') || id.includes('history')) {
|
||||||
|
return 'vendor-router';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'vendor-common-remainder';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.includes('src/pages/')) {
|
||||||
|
const pathParts = id.split('src/pages/');
|
||||||
|
if (pathParts.length > 1) {
|
||||||
|
return 'page-' + pathParts[1].split('/')[0].toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
@@ -18,9 +68,18 @@ export default defineConfig({
|
|||||||
"@app": path.resolve(__dirname, "src/app"),
|
"@app": path.resolve(__dirname, "src/app"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
chunkSizeWarningLimit: 5000,
|
chunkSizeWarningLimit: 2000,
|
||||||
},
|
|
||||||
});
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks,
|
||||||
|
|
||||||
|
entryFileNames: `assets/[name]-[hash].js`,
|
||||||
|
chunkFileNames: `assets/[name]-[hash].js`,
|
||||||
|
assetFileNames: `assets/[name]-[hash].[ext]`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) as UserConfigExport;
|
||||||
Reference in New Issue
Block a user