feat(react19-migration): 阶段1 - 项目基础设施重建
- T1.1: 卸载 Vue 依赖,安装 React 19 + Ant Design 5 + Zustand 5 + AntV 全家桶 - T1.2: Vite 配置迁移 (plugin-vue → plugin-react, manualChunks 更新) - T1.3: TypeScript 配置迁移 (jsx: preserve → react-jsx, 移除 .vue) - T1.4: ESLint 配置迁移 (Vue 规则 → React/Hooks/Refresh 规则) - T1.5: 入口文件迁移 (main.ts → main.tsx, App.vue → App.tsx, div#app → div#root) 验证: npm run dev 成功启动空白 React 应用
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src')
|
||||
@@ -20,26 +20,22 @@ export default defineConfig({
|
||||
secure: false
|
||||
}
|
||||
},
|
||||
hmr: {
|
||||
overlay: false
|
||||
},
|
||||
hmr: { overlay: false },
|
||||
cors: true
|
||||
},
|
||||
build: {
|
||||
target: 'esnext',
|
||||
minify: 'terser',
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_debugger: true
|
||||
}
|
||||
compress: { drop_console: true, drop_debugger: true }
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
'vue-vendor': ['vue', 'vue-router', 'pinia'],
|
||||
'element-plus': ['element-plus'],
|
||||
'utils': ['axios']
|
||||
'react-vendor': ['react', 'react-dom', 'react-router'],
|
||||
'antd': ['antd'],
|
||||
'antv': ['@antv/g2', '@antv/g6', '@antv/l7', '@antv/s2'],
|
||||
'utils': ['axios', 'date-fns']
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -47,15 +43,6 @@ export default defineConfig({
|
||||
reportCompressedSize: false
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['vue', 'vue-router', 'pinia', 'element-plus', 'axios'],
|
||||
exclude: []
|
||||
},
|
||||
css: {
|
||||
devSourcemap: false,
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
additionalData: `@import "@/styles/variables.scss";`
|
||||
}
|
||||
}
|
||||
include: ['react', 'react-dom', 'react-router', 'zustand', 'antd', 'axios']
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user