mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
Fix: fix javascript heap out of memory error from vite
This commit is contained in:
parent
34c3663308
commit
6e42d4fa3d
2 changed files with 37 additions and 3 deletions
|
@ -8,7 +8,7 @@
|
|||
"ESNext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"skipLibCheck": false,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
|
|
|
@ -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: "" },
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue