feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode }) => {
|
||||
// 加载环境变量
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
// 根据环境决定是否配置代理
|
||||
const shouldUseProxy = env.VITE_MOCK_ENABLED !== 'true'
|
||||
|
||||
const proxyConfig = shouldUseProxy ? {
|
||||
'/api': {
|
||||
target: env.VITE_API_BASE_URL || 'http://127.0.0.1:8080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
} : {}
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
vue()
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src')
|
||||
}
|
||||
},
|
||||
server: {
|
||||
port: Number(process.env.VITE_APP_PORT) || 5173,
|
||||
proxy: proxyConfig,
|
||||
host: true,
|
||||
hmr: {
|
||||
overlay: false
|
||||
}
|
||||
},
|
||||
build: {
|
||||
target: 'es2015',
|
||||
outDir: 'dist',
|
||||
assetsDir: 'assets',
|
||||
sourcemap: false,
|
||||
minify: 'terser',
|
||||
cssCodeSplit: true,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
// 将 Vue 相关库打包成单独的 chunk
|
||||
'vue-core': ['vue', 'vue-router', 'pinia'],
|
||||
// 将 UI 库打包成单独的 chunk
|
||||
'ant-design': ['ant-design-vue', '@ant-design/icons-vue'],
|
||||
// 将工具库打包成单独的 chunk
|
||||
'utils': ['axios', 'vue-i18n'],
|
||||
// 将图表库打包成单独的 chunk
|
||||
'charts': ['@ant-design/charts']
|
||||
},
|
||||
chunkFileNames: 'js/[name]-[hash].js',
|
||||
entryFileNames: 'js/[name]-[hash].js',
|
||||
assetFileNames: '[ext]/[name]-[hash].[ext]'
|
||||
}
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
pure_funcs: ['console.log', 'console.info', 'console.warn']
|
||||
}
|
||||
},
|
||||
// 启用 brotli 压缩
|
||||
brotliSize: true,
|
||||
// 启用 gzip 压缩
|
||||
reportCompressedSize: true
|
||||
},
|
||||
// 优化依赖预构建
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'vue',
|
||||
'vue-router',
|
||||
'pinia',
|
||||
'ant-design-vue',
|
||||
'@ant-design/icons-vue',
|
||||
'axios',
|
||||
'vue-i18n',
|
||||
'@ant-design/charts'
|
||||
],
|
||||
exclude: []
|
||||
},
|
||||
// 预加载资源
|
||||
ssr: {
|
||||
noExternal: ['ant-design-vue']
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user