feat(config): optimize dependency management and enhance isomorphic layout effect hook
- Added a comprehensive list of dependencies to optimize for faster development builds in vite.config.ts. - Improved the useIsomorphicLayoutEffect hook with additional safety checks to ensure React hooks are available in both client and server environments.
This commit is contained in:
@@ -28,6 +28,31 @@ export default defineConfig(({ command }) => {
|
||||
],
|
||||
},
|
||||
|
||||
// **Optimize Dependencies**
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'react',
|
||||
'react-dom',
|
||||
'react/jsx-runtime',
|
||||
'react/jsx-dev-runtime',
|
||||
'antd',
|
||||
'@dnd-kit/core',
|
||||
'@dnd-kit/sortable',
|
||||
'@dnd-kit/modifiers',
|
||||
'@dnd-kit/utilities',
|
||||
'react-redux',
|
||||
'@reduxjs/toolkit',
|
||||
'i18next',
|
||||
'react-i18next',
|
||||
'react-router-dom',
|
||||
'moment',
|
||||
'date-fns',
|
||||
'axios',
|
||||
'socket.io-client'
|
||||
],
|
||||
force: true, // Force re-optimization on every dev server start
|
||||
},
|
||||
|
||||
// **Build**
|
||||
build: {
|
||||
// **Target**
|
||||
|
||||
Reference in New Issue
Block a user