mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-09 17:31:19 +00:00
⚡ chore: Upgrade Vite For Node 24 (#13450)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
* chore: upgrade vite for node 24 * fix: restore production vite boot * fix: preserve dynamic pwa shell
This commit is contained in:
parent
e21146c044
commit
7dba640c9f
6 changed files with 1202 additions and 1329 deletions
|
|
@ -111,7 +111,7 @@
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"remark-math": "^6.0.0",
|
"remark-math": "^6.0.0",
|
||||||
"remark-supersub": "^1.0.0",
|
"remark-supersub": "^1.0.0",
|
||||||
"sse.js": "^2.5.0",
|
"sse.js": "^2.8.0",
|
||||||
"swr": "^2.3.8",
|
"swr": "^2.3.8",
|
||||||
"tailwind-merge": "^1.9.1",
|
"tailwind-merge": "^1.9.1",
|
||||||
"tailwindcss-animate": "^1.0.5",
|
"tailwindcss-animate": "^1.0.5",
|
||||||
|
|
@ -136,7 +136,7 @@
|
||||||
"@types/node": "^24.12.4",
|
"@types/node": "^24.12.4",
|
||||||
"@types/react": "^18.2.11",
|
"@types/react": "^18.2.11",
|
||||||
"@types/react-dom": "^18.2.4",
|
"@types/react-dom": "^18.2.4",
|
||||||
"@vitejs/plugin-react": "^5.1.4",
|
"@vitejs/plugin-react": "^6.0.2",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
||||||
"babel-plugin-root-import": "^6.6.0",
|
"babel-plugin-root-import": "^6.6.0",
|
||||||
|
|
@ -155,9 +155,9 @@
|
||||||
"postcss-preset-env": "^11.2.0",
|
"postcss-preset-env": "^11.2.0",
|
||||||
"tailwindcss": "^3.4.1",
|
"tailwindcss": "^3.4.1",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vite": "^7.3.1",
|
"vite": "^8.0.16",
|
||||||
"vite-plugin-compression2": "^2.2.1",
|
"vite-plugin-compression2": "^2.5.3",
|
||||||
"vite-plugin-node-polyfills": "^0.25.0",
|
"vite-plugin-node-polyfills": "^0.28.0",
|
||||||
"vite-plugin-pwa": "^1.2.0"
|
"vite-plugin-pwa": "^1.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ export * from './buttons';
|
||||||
export * from './dialogs';
|
export * from './dialogs';
|
||||||
export * from './display';
|
export * from './display';
|
||||||
export * from './forms';
|
export * from './forms';
|
||||||
export * from './layouts';
|
|
||||||
export * from './lists';
|
export * from './lists';
|
||||||
export * from './sidebar';
|
export * from './sidebar';
|
||||||
export * from './tree';
|
export * from './tree';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import 'regenerator-runtime/runtime';
|
import './polyfills/regeneratorRuntime';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
import './locales/i18n';
|
import './locales/i18n';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
|
||||||
3
client/src/polyfills/regeneratorRuntime.js
Normal file
3
client/src/polyfills/regeneratorRuntime.js
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import regeneratorRuntime from 'regenerator-runtime/runtime';
|
||||||
|
|
||||||
|
globalThis.regeneratorRuntime ??= regeneratorRuntime;
|
||||||
|
|
@ -12,7 +12,7 @@ const require = createRequire(import.meta.url);
|
||||||
/**
|
/**
|
||||||
* vite-plugin-node-polyfills uses @rollup/plugin-inject to replace bare globals (e.g. `process`)
|
* vite-plugin-node-polyfills uses @rollup/plugin-inject to replace bare globals (e.g. `process`)
|
||||||
* with imports like `import process from 'vite-plugin-node-polyfills/shims/process'`. When the
|
* with imports like `import process from 'vite-plugin-node-polyfills/shims/process'`. When the
|
||||||
* consuming module (e.g. recoil) is hoisted to the monorepo root, Vite 7's ESM resolver walks up
|
* consuming module (e.g. recoil) is hoisted to the monorepo root, Vite's ESM resolver walks up
|
||||||
* from there and never finds the shims (installed only in client/node_modules). This map resolves
|
* from there and never finds the shims (installed only in client/node_modules). This map resolves
|
||||||
* the shim specifiers to absolute paths via CJS require.resolve anchored to the client directory.
|
* the shim specifiers to absolute paths via CJS require.resolve anchored to the client directory.
|
||||||
*/
|
*/
|
||||||
|
|
@ -84,7 +84,8 @@ export default defineConfig(({ command }) => ({
|
||||||
],
|
],
|
||||||
globIgnores: ['images/**/*', '**/*.map', 'index.html', 'assets/rum.*.js'],
|
globIgnores: ['images/**/*', '**/*.map', 'index.html', 'assets/rum.*.js'],
|
||||||
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,
|
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,
|
||||||
navigateFallbackDenylist: [/^\/oauth/, /^\/api/],
|
/** LibreChat mutates index.html per request for subpath and language support. */
|
||||||
|
navigateFallback: null,
|
||||||
},
|
},
|
||||||
includeAssets: [],
|
includeAssets: [],
|
||||||
manifest: {
|
manifest: {
|
||||||
|
|
@ -133,164 +134,186 @@ export default defineConfig(({ command }) => ({
|
||||||
sourcemap: process.env.NODE_ENV === 'development',
|
sourcemap: process.env.NODE_ENV === 'development',
|
||||||
outDir: './dist',
|
outDir: './dist',
|
||||||
minify: 'terser',
|
minify: 'terser',
|
||||||
rollupOptions: {
|
rolldownOptions: {
|
||||||
preserveEntrySignatures: 'strict',
|
preserveEntrySignatures: 'strict',
|
||||||
output: {
|
output: {
|
||||||
manualChunks(id: string) {
|
codeSplitting: {
|
||||||
const normalizedId = id.replace(/\\/g, '/');
|
groups: [
|
||||||
if (normalizedId.includes('node_modules')) {
|
{
|
||||||
if (normalizedId.includes('@hyperdx/')) {
|
name(id: string) {
|
||||||
return 'rum';
|
const normalizedId = id.replace(/\\/g, '/');
|
||||||
}
|
if (normalizedId.includes('node_modules')) {
|
||||||
|
if (normalizedId.includes('/node_modules/regenerator-runtime/')) {
|
||||||
|
return 'polyfills';
|
||||||
|
}
|
||||||
|
|
||||||
// IMPORTANT: mermaid and ALL its dependencies must be in the same chunk
|
if (normalizedId.includes('@hyperdx/')) {
|
||||||
// to avoid initialization order issues. This includes chevrotain, langium,
|
return 'rum';
|
||||||
// dagre-d3-es, and their nested lodash-es dependencies.
|
}
|
||||||
if (
|
|
||||||
normalizedId.includes('mermaid') ||
|
|
||||||
normalizedId.includes('dagre-d3-es') ||
|
|
||||||
normalizedId.includes('chevrotain') ||
|
|
||||||
normalizedId.includes('langium') ||
|
|
||||||
normalizedId.includes('lodash-es')
|
|
||||||
) {
|
|
||||||
return 'mermaid';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalizedId.includes('@codesandbox/sandpack')) {
|
// IMPORTANT: mermaid and ALL its dependencies must be in the same chunk
|
||||||
return 'sandpack';
|
// to avoid initialization order issues. This includes chevrotain, langium,
|
||||||
}
|
// dagre-d3-es, and their nested lodash-es dependencies.
|
||||||
if (normalizedId.includes('react-vtree')) {
|
if (
|
||||||
return 'react-vtree';
|
normalizedId.includes('mermaid') ||
|
||||||
}
|
normalizedId.includes('dagre-d3-es') ||
|
||||||
if (normalizedId.includes('react-virtualized')) {
|
normalizedId.includes('chevrotain') ||
|
||||||
return 'virtualization';
|
normalizedId.includes('langium') ||
|
||||||
}
|
normalizedId.includes('lodash-es')
|
||||||
if (normalizedId.includes('i18next') || normalizedId.includes('react-i18next')) {
|
) {
|
||||||
return 'i18n';
|
return 'mermaid';
|
||||||
}
|
}
|
||||||
// Only regular lodash (not lodash-es which goes to mermaid chunk)
|
|
||||||
if (normalizedId.includes('/lodash/')) {
|
|
||||||
return 'utilities';
|
|
||||||
}
|
|
||||||
if (normalizedId.includes('date-fns')) {
|
|
||||||
return 'date-utils';
|
|
||||||
}
|
|
||||||
if (normalizedId.includes('@dicebear')) {
|
|
||||||
return 'avatars';
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalizedId.includes('react-dnd') ||
|
|
||||||
normalizedId.includes('dnd-core') ||
|
|
||||||
normalizedId.includes('react-flip-toolkit') ||
|
|
||||||
normalizedId.includes('flip-toolkit')
|
|
||||||
) {
|
|
||||||
return 'react-interactions';
|
|
||||||
}
|
|
||||||
if (normalizedId.includes('react-hook-form')) {
|
|
||||||
return 'forms';
|
|
||||||
}
|
|
||||||
if (normalizedId.includes('react-router-dom')) {
|
|
||||||
return 'routing';
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalizedId.includes('qrcode.react') ||
|
|
||||||
normalizedId.includes('@marsidev/react-turnstile')
|
|
||||||
) {
|
|
||||||
return 'security-ui';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (normalizedId.includes('@codemirror/view')) {
|
if (normalizedId.includes('@codesandbox/sandpack')) {
|
||||||
return 'codemirror-view';
|
return 'sandpack';
|
||||||
}
|
}
|
||||||
if (normalizedId.includes('@codemirror/state')) {
|
if (normalizedId.includes('react-vtree')) {
|
||||||
return 'codemirror-state';
|
return 'react-vtree';
|
||||||
}
|
}
|
||||||
if (normalizedId.includes('@codemirror/language')) {
|
if (normalizedId.includes('react-virtualized')) {
|
||||||
return 'codemirror-language';
|
return 'virtualization';
|
||||||
}
|
}
|
||||||
if (normalizedId.includes('@codemirror')) {
|
if (normalizedId.includes('i18next') || normalizedId.includes('react-i18next')) {
|
||||||
return 'codemirror-core';
|
return 'i18n';
|
||||||
}
|
}
|
||||||
|
// Only regular lodash (not lodash-es which goes to mermaid chunk)
|
||||||
|
if (normalizedId.includes('/lodash/')) {
|
||||||
|
return 'utilities';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('date-fns')) {
|
||||||
|
return 'date-utils';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('@dicebear')) {
|
||||||
|
return 'avatars';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
normalizedId.includes('react-dnd') ||
|
||||||
|
normalizedId.includes('dnd-core') ||
|
||||||
|
normalizedId.includes('react-flip-toolkit') ||
|
||||||
|
normalizedId.includes('flip-toolkit')
|
||||||
|
) {
|
||||||
|
return 'react-interactions';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('react-hook-form')) {
|
||||||
|
return 'forms';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('react-router-dom')) {
|
||||||
|
return 'routing';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
normalizedId.includes('qrcode.react') ||
|
||||||
|
normalizedId.includes('@marsidev/react-turnstile')
|
||||||
|
) {
|
||||||
|
return 'security-ui';
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (normalizedId.includes('@codemirror/view')) {
|
||||||
normalizedId.includes('react-markdown') ||
|
return 'codemirror-view';
|
||||||
normalizedId.includes('remark-') ||
|
}
|
||||||
normalizedId.includes('rehype-')
|
if (normalizedId.includes('@codemirror/state')) {
|
||||||
) {
|
return 'codemirror-state';
|
||||||
return 'markdown-processing';
|
}
|
||||||
}
|
if (normalizedId.includes('@codemirror/language')) {
|
||||||
if (normalizedId.includes('monaco-editor') || normalizedId.includes('@monaco-editor')) {
|
return 'codemirror-language';
|
||||||
return 'code-editor';
|
}
|
||||||
}
|
if (normalizedId.includes('@codemirror')) {
|
||||||
if (normalizedId.includes('react-window') || normalizedId.includes('react-virtual')) {
|
return 'codemirror-core';
|
||||||
return 'virtualization';
|
}
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalizedId.includes('zod') ||
|
|
||||||
normalizedId.includes('yup') ||
|
|
||||||
normalizedId.includes('joi')
|
|
||||||
) {
|
|
||||||
return 'validation';
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalizedId.includes('axios') ||
|
|
||||||
normalizedId.includes('ky') ||
|
|
||||||
normalizedId.includes('fetch')
|
|
||||||
) {
|
|
||||||
return 'http-client';
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
normalizedId.includes('react-spring') ||
|
|
||||||
normalizedId.includes('react-transition-group')
|
|
||||||
) {
|
|
||||||
return 'animations';
|
|
||||||
}
|
|
||||||
if (normalizedId.includes('react-select') || normalizedId.includes('downshift')) {
|
|
||||||
return 'advanced-inputs';
|
|
||||||
}
|
|
||||||
if (normalizedId.includes('heic-to')) {
|
|
||||||
return 'heic-converter';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Existing chunks
|
if (
|
||||||
if (normalizedId.includes('@radix-ui')) {
|
normalizedId.includes('react-markdown') ||
|
||||||
return 'radix-ui';
|
normalizedId.includes('remark-') ||
|
||||||
}
|
normalizedId.includes('rehype-')
|
||||||
if (normalizedId.includes('framer-motion')) {
|
) {
|
||||||
return 'framer-motion';
|
return 'markdown-processing';
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
normalizedId.includes('node_modules/highlight.js') ||
|
normalizedId.includes('monaco-editor') ||
|
||||||
normalizedId.includes('node_modules/lowlight')
|
normalizedId.includes('@monaco-editor')
|
||||||
) {
|
) {
|
||||||
return 'markdown_highlight';
|
return 'code-editor';
|
||||||
}
|
}
|
||||||
if (normalizedId.includes('katex') || normalizedId.includes('node_modules/katex')) {
|
if (
|
||||||
return 'math-katex';
|
normalizedId.includes('react-window') ||
|
||||||
}
|
normalizedId.includes('react-virtual')
|
||||||
if (normalizedId.includes('node_modules/hast-util-raw')) {
|
) {
|
||||||
return 'markdown_large';
|
return 'virtualization';
|
||||||
}
|
}
|
||||||
if (normalizedId.includes('@tanstack')) {
|
if (
|
||||||
return 'tanstack-vendor';
|
normalizedId.includes('zod') ||
|
||||||
}
|
normalizedId.includes('yup') ||
|
||||||
if (normalizedId.includes('@headlessui')) {
|
normalizedId.includes('joi')
|
||||||
return 'headlessui';
|
) {
|
||||||
}
|
return 'validation';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
normalizedId.includes('axios') ||
|
||||||
|
normalizedId.includes('ky') ||
|
||||||
|
normalizedId.includes('fetch')
|
||||||
|
) {
|
||||||
|
return 'http-client';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
normalizedId.includes('react-spring') ||
|
||||||
|
normalizedId.includes('react-transition-group')
|
||||||
|
) {
|
||||||
|
return 'animations';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('react-select') || normalizedId.includes('downshift')) {
|
||||||
|
return 'advanced-inputs';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('heic-to')) {
|
||||||
|
return 'heic-converter';
|
||||||
|
}
|
||||||
|
|
||||||
if (normalizedId.includes('@icons-pack/react-simple-icons/icons/')) {
|
// Existing chunks
|
||||||
return;
|
if (normalizedId.includes('@radix-ui')) {
|
||||||
}
|
return 'radix-ui';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('framer-motion')) {
|
||||||
|
return 'framer-motion';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
normalizedId.includes('node_modules/highlight.js') ||
|
||||||
|
normalizedId.includes('node_modules/lowlight')
|
||||||
|
) {
|
||||||
|
return 'markdown_highlight';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
normalizedId.includes('katex') ||
|
||||||
|
normalizedId.includes('node_modules/katex')
|
||||||
|
) {
|
||||||
|
return 'math-katex';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('node_modules/hast-util-raw')) {
|
||||||
|
return 'markdown_large';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('@tanstack')) {
|
||||||
|
return 'tanstack-vendor';
|
||||||
|
}
|
||||||
|
if (normalizedId.includes('@headlessui')) {
|
||||||
|
return 'headlessui';
|
||||||
|
}
|
||||||
|
|
||||||
// Everything else falls into a generic vendor chunk.
|
if (normalizedId.includes('@icons-pack/react-simple-icons/icons/')) {
|
||||||
return 'vendor';
|
return null;
|
||||||
}
|
}
|
||||||
// Create a separate chunk for all locale files under src/locales.
|
|
||||||
if (normalizedId.includes('/src/locales/')) {
|
// Everything else falls into a generic vendor chunk.
|
||||||
return 'locales';
|
return 'vendor';
|
||||||
}
|
}
|
||||||
// Let Rollup decide automatically for any other files.
|
if (normalizedId.includes('/src/polyfills/')) {
|
||||||
return null;
|
return 'polyfills';
|
||||||
|
}
|
||||||
|
// Create a separate chunk for all locale files under src/locales.
|
||||||
|
if (normalizedId.includes('/src/locales/')) {
|
||||||
|
return 'locales';
|
||||||
|
}
|
||||||
|
// Let Rolldown decide automatically for any other files.
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
entryFileNames: 'assets/[name].[hash].js',
|
entryFileNames: 'assets/[name].[hash].js',
|
||||||
chunkFileNames: 'assets/[name].[hash].js',
|
chunkFileNames: 'assets/[name].[hash].js',
|
||||||
|
|
|
||||||
2188
package-lock.json
generated
2188
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue