vite.config.ts 1.6 KB

1234567891011121314151617181920212223242526
  1. import { fileURLToPath } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import react from '@vitejs/plugin-react'
  4. const src = (rel: string): string => fileURLToPath(new URL(rel, import.meta.url))
  5. export default defineConfig({
  6. plugins: [react()],
  7. resolve: {
  8. // Workspace packages resolve to SOURCE: package.json exports point at lib
  9. // for Node/type consumers, but the browser bundle must compile src directly
  10. // so CSS rides vite's pipeline instead of the CSS-externalized lib bundle.
  11. // Only the shell's static surface is aliased — UI plugin packages are NOT
  12. // bundled here; they arrive as dynamic bundles through the client loader.
  13. // Order matters — subpath aliases must win over bare-name prefixes.
  14. alias: [
  15. { find: /^@deepseek-ai\/dsh-client-web$/, replacement: src('../../packages/client/web/src/boot.tsx') },
  16. { find: /^@deepseek-ai\/dsh-client-web-react\/store$/, replacement: src('../../packages/client/web-react/src/store/index.ts') },
  17. { find: /^@deepseek-ai\/dsh-client-web-react$/, replacement: src('../../packages/client/web-react/src/index.ts') },
  18. { find: /^@deepseek-ai\/dsh-client-ui-slots$/, replacement: src('../../packages/client/ui-slots/src/index.ts') },
  19. { find: /^@deepseek-ai\/dsh-client-ui-primitives$/, replacement: src('../../packages/client/ui-primitives/src/index.ts') },
  20. { find: /^@deepseek-ai\/dsh-client-runtime\/loader$/, replacement: src('../../packages/client/runtime/src/client/loader/index.ts') },
  21. { find: /^@deepseek-ai\/dsh-client-runtime$/, replacement: src('../../packages/client/runtime/src/index.ts') },
  22. ],
  23. },
  24. })