mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-05 07:40:19 +01:00
⚡ chore: bump vite to v7 (#12031)
* 🔧 chore: Update @vitejs/plugin-react to version 5.1.4 and clean up package-lock.json - Upgraded @vitejs/plugin-react from version 4.3.4 to 5.1.4 in both package.json and package-lock.json. - Removed unused dependencies related to previous plugin versions from package-lock.json. - Updated @babel/compat-data to version 7.29.0 and added new dependencies for Babel plugins. * 🔧 chore: Upgrade vite-plugin-pwa to version 1.2.0 in package.json and package-lock.json - Updated vite-plugin-pwa from version 0.21.2 to 1.2.0 in both package.json and package-lock.json to ensure compatibility with the latest features and improvements. - Removed outdated dependency entries related to the previous version from package-lock.json. * 🔧 chore: Upgrade vite to version 7.3.1 in package.json and package-lock.json - Updated vite from version 6.4.1 to 7.3.1 in both package.json and package-lock.json to leverage new features and improvements. - Added new esbuild packages for various architectures in package-lock.json to support broader compatibility. * 🔧 chore: Update @babel dependencies and vite-plugin-node-polyfills version in package.json and package-lock.json - Upgraded vite-plugin-node-polyfills from version 0.23.0 to 0.25.0 for improved compatibility. - Added several new @babel packages and updated existing ones to version 7.29.0 and 7.28.6, enhancing Babel's functionality and support. - Removed outdated semver entries from package-lock.json to streamline dependencies. * 🔧 chore: Vite configuration with node polyfills resolver and clean up imports - Added a custom resolver for node polyfills shims to improve compatibility with legacy modules. - Cleaned up import statements by removing unnecessary comments and organizing imports for better readability. - Utilized `createRequire` to handle module resolution in a more efficient manner. * 🔧 chore: Upgrade fast-xml-parser to version 5.3.8 in package.json and package-lock.json - Updated fast-xml-parser from version 5.3.6 to 5.3.8 in both package.json and package-lock.json to incorporate the latest features and improvements. - Ensured consistency across dependencies by aligning the version in all relevant files. * 🔧 chore: Upgrade @types/node to version 20.19.35 in package.json and package-lock.json - Updated @types/node from version 20.3.0 to 20.19.35 in both package.json and package-lock.json to ensure compatibility with the latest TypeScript features and improvements. * 🔧 chore: Vite configuration to centralize node polyfills shims - Moved node polyfills shims into a dedicated constant for improved readability and maintainability. - Updated the custom resolver to utilize the new centralized shims, enhancing compatibility with legacy modules. - Added documentation to clarify the purpose of the node polyfills shims mapping.
This commit is contained in:
parent
b1771e0a6e
commit
23237255d8
4 changed files with 1284 additions and 858 deletions
|
|
@ -130,10 +130,10 @@
|
|||
"@types/jest": "^29.5.14",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/lodash": "^4.17.15",
|
||||
"@types/node": "^20.3.0",
|
||||
"@types/node": "^20.19.35",
|
||||
"@types/react": "^18.2.11",
|
||||
"@types/react-dom": "^18.2.4",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
||||
"babel-plugin-root-import": "^6.6.0",
|
||||
|
|
@ -151,9 +151,9 @@
|
|||
"postcss-preset-env": "^11.2.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^6.4.1",
|
||||
"vite": "^7.3.1",
|
||||
"vite-plugin-compression2": "^2.2.1",
|
||||
"vite-plugin-node-polyfills": "^0.23.0",
|
||||
"vite-plugin-pwa": "^0.21.2"
|
||||
"vite-plugin-node-polyfills": "^0.25.0",
|
||||
"vite-plugin-pwa": "^1.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,32 @@
|
|||
import react from '@vitejs/plugin-react';
|
||||
// @ts-ignore
|
||||
import path from 'path';
|
||||
import type { Plugin } from 'vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import { createRequire } from 'module';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import { compression } from 'vite-plugin-compression2';
|
||||
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import type { Plugin } from 'vite';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* consuming module (e.g. recoil) is hoisted to the monorepo root, Vite 7's ESM resolver walks up
|
||||
* 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.
|
||||
*/
|
||||
const NODE_POLYFILL_SHIMS: Record<string, string> = {
|
||||
'vite-plugin-node-polyfills/shims/process': require.resolve(
|
||||
'vite-plugin-node-polyfills/shims/process',
|
||||
),
|
||||
'vite-plugin-node-polyfills/shims/buffer': require.resolve(
|
||||
'vite-plugin-node-polyfills/shims/buffer',
|
||||
),
|
||||
'vite-plugin-node-polyfills/shims/global': require.resolve(
|
||||
'vite-plugin-node-polyfills/shims/global',
|
||||
),
|
||||
};
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
const backendPort = (process.env.BACKEND_PORT && Number(process.env.BACKEND_PORT)) || 3080;
|
||||
|
|
@ -37,6 +58,12 @@ export default defineConfig(({ command }) => ({
|
|||
envPrefix: ['VITE_', 'SCRIPT_', 'DOMAIN_', 'ALLOW_'],
|
||||
plugins: [
|
||||
react(),
|
||||
{
|
||||
name: 'node-polyfills-shims-resolver',
|
||||
resolveId(id) {
|
||||
return NODE_POLYFILL_SHIMS[id] ?? null;
|
||||
},
|
||||
},
|
||||
nodePolyfills(),
|
||||
VitePWA({
|
||||
injectRegister: 'auto', // 'auto' | 'manual' | 'disabled'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue