mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 10:19:32 +08:00
前端公共部分开发完成,支持图片展示功能
This commit is contained in:
@@ -1,14 +1,40 @@
|
||||
import path from 'node:path'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
export default defineConfig(({ mode }) => {
|
||||
// 加载环境变量
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
return {
|
||||
plugins: [vue(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
},
|
||||
// 构建配置
|
||||
build: {
|
||||
// 输出到上级目录的web文件夹
|
||||
outDir: path.resolve(__dirname, '../web'),
|
||||
// 清空输出目录
|
||||
emptyOutDir: true,
|
||||
// 静态资源处理
|
||||
assetsDir: 'assets',
|
||||
// 生成 sourcemap 用于生产环境调试
|
||||
sourcemap: mode === 'development'
|
||||
},
|
||||
// 开发服务器配置
|
||||
server: {
|
||||
port: 5173,
|
||||
strictPort: false,
|
||||
open: false
|
||||
},
|
||||
// 环境变量配置 - 开发环境使用完整URL,生产环境使用相对路径
|
||||
define: {
|
||||
__API_BASE_URL__: JSON.stringify(env.VITE_API_BASE_URL || '/api/v1')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user