Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

Fix: fix javascript heap out of memory error from vite

Daniel D Orlando6e42d4fa3da8
diff --git a/client/tsconfig.json b/client/tsconfig.json
index c9ae48d29d..fd38a638a6 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -8,7 +8,7 @@
"ESNext"
],
"allowJs": true,
- "skipLibCheck": true,
+ "skipLibCheck": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
diff --git a/client/vite.config.ts b/client/vite.config.ts
index 73edb63a9c..b9e3da31ca 100644
--- a/client/vite.config.ts
+++ b/client/vite.config.ts
@@ -1,6 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
+import type { Plugin } from "vite";
// https://vitejs.dev/config/
export default defineConfig({
@@ -19,11 +20,25 @@ export default defineConfig({
}
}
},
- plugins: [react()],
+ plugins: [react(), sourcemapExclude({ excludeNodeModules: true }),],
publicDir: './public',
build: {
sourcemap: true,
- outDir: './dist'
+ outDir: './dist',
+ rollupOptions: {
+ output: {
+ manualChunks: (id) => {
+ if (id.includes("node_modules")) {
+ return "vendor";
+ }
+ },
+ sourcemapIgnoreList: (relativeSourcePath) => {
+ const normalizedPath = path.normalize(relativeSourcePath);
+ return normalizedPath.includes("node_modules");
+ },
+ },
+ cache: false,
+ },
},
resolve: {
alias: {
@@ -31,3 +46,22 @@ export default defineConfig({
}
}
});
+
+interface SourcemapExclude {
+ excludeNodeModules?: boolean;
+}
+export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
+ return {
+ name: "sourcemap-exclude",
+ transform(code: string, id: string) {
+ if (opts?.excludeNodeModules && id.includes("node_modules")) {
+ return {
+ code,
+ // https://github.com/rollup/rollup/blob/master/docs/plugin-development/index.md#source-code-transformations
+ map: { mappings: "" },
+ };
+ }
+ },
+ };
+}
+