mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
- Added support for JSX in Vite configuration by including the vueJsx plugin. - Simplified the metrics display in CurrentMetrics.vue to show only the percentage of used memory and disk. - Adjusted CSS in CurrentMetrics.vue to prevent wrapping and added a gap between items for better layout. - Refactored TableCell.vue to remove unused imports, optimizing the component. - Updated useNodeList.tsx to replace NodeType with ClNodeType and made minor formatting adjustments for consistency.
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { resolve } from 'path';
|
|
import { defineConfig, UserConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
|
import dynamicImport from 'vite-plugin-dynamic-import';
|
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const config: UserConfig = {
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id, meta) {
|
|
if (id.includes('node_modules')) {
|
|
const arr = id.toString().split('node_modules/');
|
|
const modulePath = arr[arr.length - 1];
|
|
return modulePath?.split('/')?.[0];
|
|
}
|
|
if (id.includes('three.min.js')) {
|
|
return 'three';
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: ['element-plus', 'axios', 'monaco-editor'],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
},
|
|
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
|
},
|
|
// @ts-ignore
|
|
plugins: [vue(), vueJsx(), dynamicImport()],
|
|
server: {
|
|
cors: true,
|
|
},
|
|
};
|
|
|
|
if (mode === 'analyze') {
|
|
// @ts-ignore
|
|
config.plugins.push(visualizer({ open: true, gzipSize: true }));
|
|
}
|
|
|
|
return config;
|
|
});
|