refactor: Use librechat-data-provider app-wide 🔄 (#1326)

* chore: bump vite, vitejs/plugin-react, mark client package as esm, move react-query as a peer dep in data-provider

* chore: import changes due to new data-provider export strategy, also fix type imports where applicable

* chore: export react-query services as separate to avoid react dependencies in /api/

* chore: suppress sourcemap warnings and polyfill node:path which is used by filenamify
TODO: replace filenamify with an alternative and REMOVE polyfill

* chore: /api/ changes to support `librechat-data-provider`

* refactor: rewrite Dockerfile.multi in light of /api/ changes to support `librechat-data-provider`

* chore: remove volume mapping to node_modules directories in default compose file

* chore: remove schemas from /api/ as is no longer needed with use of `librechat-data-provider`

* fix(ci): jest `librechat-data-provider/react-query` module resolution
This commit is contained in:
Danny Avila 2023-12-11 14:48:40 -05:00 committed by GitHub
parent d4c846b543
commit df1dfa7d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
97 changed files with 1831 additions and 1343 deletions

View file

@ -1,3 +1,4 @@
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import path, { resolve } from 'path';
@ -23,7 +24,7 @@ export default defineConfig({
// All other env variables are filtered out
envDir: '../',
envPrefix: ['VITE_', 'SCRIPT_', 'DOMAIN_', 'ALLOW_'],
plugins: [react(), sourcemapExclude({ excludeNodeModules: true })],
plugins: [react(), nodePolyfills(), sourcemapExclude({ excludeNodeModules: true })],
publicDir: './public',
build: {
sourcemap: process.env.NODE_ENV === 'development',
@ -37,6 +38,19 @@ export default defineConfig({
}
},
},
/**
* Ignore "use client" waning since we are not using SSR
* @see {@link https://github.com/TanStack/query/pull/5161#issuecomment-1477389761 Preserve 'use client' directives TanStack/query#5161}
*/
onwarn(warning, warn) {
if (
// warning.code === 'MODULE_LEVEL_DIRECTIVE' &&
warning.message.includes('Error when using sourcemap')
) {
return;
}
warn(warning);
},
},
},
resolve: {