Files
ssessesse-ki-battle/vite.config.ts
T

35 lines
1.7 KiB
TypeScript

import { defineConfig } from 'vite';
import { resolve } from 'node:path';
import { GAME_NAME, GAME_DESCRIPTION, GAME_URL, GAME_SHARE_IMAGE } from './constants/branding.js';
export default defineConfig({
root: 'src/client',
plugins: [{
name: 'game-share-metadata',
transformIndexHtml(_html, context) {
if (context.path !== '/index.html' && context.path !== '/') return [];
return [
{ name: 'description', content: GAME_DESCRIPTION },
{ property: 'og:type', content: 'website' },
{ property: 'og:locale', content: 'ko_KR' },
{ property: 'og:site_name', content: GAME_NAME },
{ property: 'og:title', content: GAME_NAME },
{ property: 'og:description', content: GAME_DESCRIPTION },
{ property: 'og:url', content: GAME_URL },
{ property: 'og:image', content: GAME_SHARE_IMAGE },
{ property: 'og:image:type', content: 'image/png' },
{ property: 'og:image:width', content: '1200' },
{ property: 'og:image:height', content: '630' },
{ property: 'og:image:alt', content: `${GAME_NAME} 타이틀과 세 캐릭터` },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:title', content: GAME_NAME },
{ name: 'twitter:description', content: GAME_DESCRIPTION },
{ name: 'twitter:image', content: GAME_SHARE_IMAGE },
{ name: 'twitter:image:alt', content: `${GAME_NAME} 타이틀과 세 캐릭터` },
].map(attrs => ({ tag: 'meta', attrs, injectTo: 'head' as const }));
},
}],
build: { outDir: '../../dist/client', emptyOutDir: true,
rollupOptions: { input: { game: resolve('src/client/index.html'), admin: resolve('src/client/admin/analytics/index.html') } },
},
});