index.html 을 두 배포가 공용으로 쓰는데 제목이 하나뿐이라, webforai.kr 이 AI Discovery 랜딩을 띄우면서 제목은 'INFINITH - Infinite Marketing' 으로 나갔다. 설명과 og 태그는 아예 없었다. 답변엔진이 읽는 첫 신호라 비워 두면 안 되는 자리다. VITE_SITE=discovery 빌드는 AI Discovery 제목·설명을, 아니면 기존 INFINITH 제목을 넣는다. 설명과 og:title·og:description·og:type·og:locale 도 함께 넣는다. 검증: 변수 없는 빌드는 기존 제목 유지, discovery 빌드는 새 제목. tsc 0 에러. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
61 lines
2.3 KiB
TypeScript
61 lines
2.3 KiB
TypeScript
import tailwindcss from '@tailwindcss/vite';
|
||
import react from '@vitejs/plugin-react';
|
||
import path from 'path';
|
||
import {defineConfig, loadEnv} from 'vite';
|
||
import { supabaseSync } from './plugins/vite-plugin-supabase-sync';
|
||
|
||
export default defineConfig(({mode}) => {
|
||
const env = loadEnv(mode, '.', '');
|
||
// 배포별 head 메타. VITE_SITE=discovery 로 빌드한 배포(webforai.kr)는 AI Discovery 랜딩이 루트라
|
||
// 제목·설명도 그에 맞아야 한다. index.html 은 두 배포가 공용이므로 빌드 때 갈아끼운다.
|
||
// 답변엔진이 읽는 첫 신호라 비워 두지 않는다.
|
||
const isDiscovery = env.VITE_SITE === 'discovery';
|
||
const head = isDiscovery
|
||
? {
|
||
title: 'AI Discovery · 우리 병원은 AI 답변에 나오고 있습니까',
|
||
description: '병원 홈페이지 주소 하나로 AI 답변 준비도를 진단하고, 무엇을 고쳐야 하는지 근거와 함께 알려 드립니다.',
|
||
}
|
||
: {
|
||
title: 'INFINITH - Infinite Marketing',
|
||
description: 'AI 마케팅 분석 플랫폼. 채널을 진단하고 전략과 로드맵을 제안합니다.',
|
||
};
|
||
const headHtml = [
|
||
`<title>${head.title}</title>`,
|
||
`<meta name="description" content="${head.description}" />`,
|
||
`<meta property="og:type" content="website" />`,
|
||
`<meta property="og:title" content="${head.title}" />`,
|
||
`<meta property="og:description" content="${head.description}" />`,
|
||
`<meta property="og:locale" content="ko_KR" />`,
|
||
].join('\n ');
|
||
|
||
return {
|
||
plugins: [
|
||
react(),
|
||
{
|
||
name: 'infinith-head',
|
||
transformIndexHtml(html: string) {
|
||
return html.replace(/<title>[\s\S]*?<\/title>/, headHtml);
|
||
},
|
||
},
|
||
tailwindcss(),
|
||
supabaseSync({
|
||
supabaseUrl: env.VITE_SUPABASE_URL ?? '',
|
||
serviceRoleKey: env.SUPABASE_SERVICE_ROLE_KEY ?? env.VITE_SUPABASE_ANON_KEY ?? '',
|
||
}),
|
||
],
|
||
define: {
|
||
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
||
},
|
||
resolve: {
|
||
alias: {
|
||
'@': path.resolve(__dirname, '.'),
|
||
},
|
||
},
|
||
server: {
|
||
// HMR is disabled in AI Studio via DISABLE_HMR env var.
|
||
// Do not modifyâfile watching is disabled to prevent flickering during agent edits.
|
||
hmr: process.env.DISABLE_HMR !== 'true',
|
||
},
|
||
};
|
||
});
|