Vue 3 模块化作品集主页,浅色极简风格,中英双语懒加载 i18n。 - 模块注册表(import.meta.glob)约定式收集项目模块,新增页签无需改导航/路由 - i18n: 中文同步注入主 chunk,英文动态 import() 拆独立 chunk,仅切换时下载 - 第一个页签 mobile-game: 展示 448/449 移动游戏毕设(概览/截图轮播/版本时间线/团队/排行榜/ML视频) - 排行榜复用 /449/449rest.php,失败优雅降级 - 构建: vite outDir=/root/html,emptyOutDir=false,产物用 mainPage/ 命名空间 - 样式: CSS 变量令牌,无 UI 框架运行时依赖
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { defineConfig } from 'vite'
|
||
import vue from '@vitejs/plugin-vue'
|
||
|
||
// 构建产物输出到站点根 /root/html,但绝不清空该目录
|
||
// (里面已有 448/449/js/css 等既有内容)。
|
||
// 用 mainPage/ 命名空间子目录避免与 /root/html/js、/root/html/css 旧文件冲突。
|
||
export default defineConfig({
|
||
plugins: [vue()],
|
||
base: '/',
|
||
build: {
|
||
outDir: '/root/html',
|
||
// ★ 安全项:不清空 outDir,保护既有文件
|
||
emptyOutDir: false,
|
||
rollupOptions: {
|
||
output: {
|
||
entryFileNames: 'js/mainPage/[name].[hash].js',
|
||
chunkFileNames: 'js/mainPage/[name].[hash].js',
|
||
assetFileNames: (assetInfo) => {
|
||
const name = assetInfo.name || ''
|
||
if (name.endsWith('.css')) {
|
||
return 'css/mainPage/[name].[hash][extname]'
|
||
}
|
||
return 'assets/mainPage/[name].[hash][extname]'
|
||
}
|
||
}
|
||
}
|
||
},
|
||
server: {
|
||
// 开发服务器把站点根的静态资源代理到 /root/html,方便引用 /448 /449 等
|
||
port: 5173,
|
||
proxy: {
|
||
'/448': {
|
||
target: 'http://localhost:8080',
|
||
changeOrigin: true
|
||
},
|
||
'/449': {
|
||
target: 'http://localhost:8080',
|
||
changeOrigin: true
|
||
}
|
||
}
|
||
}
|
||
})
|