- 添加 Zustand 状态管理库 - 配置开发和生产环境变量 - 更新 Vite 构建配置 - 更新 Git 钩子配置 - 修复 NavBar 组件的 React Hooks 规则问题
41 lines
885 B
TypeScript
41 lines
885 B
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import svgrPlugin from '@arco-plugins/vite-plugin-svgr';
|
|
import vitePluginForArco from '@arco-plugins/vite-react';
|
|
import setting from './src/settings.json';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: [{ find: '@', replacement: '/src' }],
|
|
},
|
|
plugins: [
|
|
react(),
|
|
svgrPlugin({
|
|
svgrOptions: {},
|
|
}),
|
|
vitePluginForArco({
|
|
theme: '@arco-themes/react-arco-pro',
|
|
modifyVars: {
|
|
'arcoblue-6': setting.themeColor,
|
|
},
|
|
}),
|
|
],
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
|
},
|
|
},
|
|
},
|
|
});
|