Skip to content

Commit 9c97f0a

Browse files
author
Faxbot Agent
committed
fix(ui): hard alias react/react-dom and jsx-runtime to single node_modules paths to eliminate duplicate React at runtime
1 parent 32bdc23 commit 9c97f0a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

api/admin_ui/vite.config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
3+
import path from 'path'
34

45
export default defineConfig({
56
plugins: [react()],
67
base: '/admin/ui/',
78
resolve: {
8-
// Prevent multiple React copies (fixes hooks/dispatcher issues)
9-
dedupe: ['react', 'react-dom']
9+
// Ensure a single React/DOM copy is bundled and referenced
10+
dedupe: ['react', 'react-dom'],
11+
alias: {
12+
react: path.resolve(__dirname, 'node_modules/react'),
13+
'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
14+
'react/jsx-runtime': path.resolve(__dirname, 'node_modules/react/jsx-runtime'),
15+
'react/jsx-dev-runtime': path.resolve(__dirname, 'node_modules/react/jsx-dev-runtime'),
16+
}
1017
},
1118
css: {
1219
// Prevent PostCSS from walking up outside the project (avoids permission errors)

v3_plans

Lines changed: 0 additions & 1 deletion
This file was deleted.

v4_plans

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)