Skip to content

Commit a7a5525

Browse files
chore: removed chunk splitting and aliases to fix build issues with vercel and launch
1 parent 7bfac09 commit a7a5525

File tree

1 file changed

+16
-61
lines changed

1 file changed

+16
-61
lines changed

vite.config.ts

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,29 @@
1-
import { defineConfig } from 'vite';
2-
import react from '@vitejs/plugin-react';
3-
import path from 'path';
1+
import { defineConfig } from "vite";
2+
import react from "@vitejs/plugin-react";
3+
import path from "path";
44

5-
// https://vitejs.dev/config/
65
export default defineConfig({
76
plugins: [react()],
87
resolve: {
98
alias: {
10-
'@': path.resolve(__dirname, './src'),
11-
// Add component path aliases for easier imports
12-
'@components': path.resolve(__dirname, './src/components'),
13-
'@context': path.resolve(__dirname, './src/context'),
14-
'@helper': path.resolve(__dirname, './src/helper'),
15-
'@sdk': path.resolve(__dirname, './src/sdk'),
16-
'@styles': path.resolve(__dirname, './src/styles'),
9+
"@": path.resolve(__dirname, "src"),
1710
},
1811
},
12+
build: {
13+
outDir: "dist",
14+
chunkSizeWarningLimit: 1000,
15+
},
16+
1917
server: {
2018
port: 3000,
21-
// Add HMR setup for better development experience
22-
hmr: {
23-
overlay: true,
24-
},
19+
open: true,
2520
},
26-
// Add build optimizations
27-
build: {
28-
outDir: 'dist',
29-
sourcemap: true,
30-
// Increase the warning limit to reduce noise for larger chunks
31-
chunkSizeWarningLimit: 600,
32-
// Chunk splitting strategy for better caching
33-
rollupOptions: {
34-
output: {
35-
// Code splitting configuration
36-
manualChunks: (id) => {
37-
// Split React and related packages
38-
if (id.includes('node_modules/react') ||
39-
id.includes('node_modules/react-dom') ||
40-
id.includes('node_modules/scheduler')) {
41-
return 'react-vendor';
42-
}
43-
44-
// Split Contentstack SDK and related packages
45-
if (id.includes('node_modules/contentstack') ||
46-
id.includes('node_modules/@contentstack')) {
47-
return 'contentstack-vendor';
48-
}
49-
50-
// Split React Router and related packages
51-
if (id.includes('node_modules/react-router') ||
52-
id.includes('node_modules/@remix-run') ||
53-
id.includes('node_modules/react-router-dom')) {
54-
return 'router-vendor';
55-
}
56-
57-
// Split other common libraries
58-
if (id.includes('node_modules/')) {
59-
// Create a chunk for any remaining node_modules
60-
return 'vendor';
61-
}
62-
},
63-
// Configure chunk naming format to include content hashes
64-
entryFileNames: 'assets/[name]-[hash].js',
65-
chunkFileNames: 'assets/[name]-[hash].js',
66-
assetFileNames: 'assets/[name]-[hash].[ext]',
67-
},
21+
optimizeDeps: {
22+
esbuildOptions: {
23+
target: "es2020",
6824
},
6925
},
70-
define: {
71-
// Handle process.env references
72-
'process.env': process.env,
26+
esbuild: {
27+
logOverride: { "this-is-undefined-in-esm": "silent" },
7328
},
74-
});
29+
});

0 commit comments

Comments
 (0)