From b2fa06d5fa61a041acb94b1051c3c22500460c22 Mon Sep 17 00:00:00 2001 From: syui Date: Wed, 11 Jun 2025 15:16:06 +0900 Subject: [PATCH] fix config vite --- aicard-web-oauth/src/main.tsx | 2 +- aicard-web-oauth/vite.config.ts | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/aicard-web-oauth/src/main.tsx b/aicard-web-oauth/src/main.tsx index f8190ef..e3d4afb 100644 --- a/aicard-web-oauth/src/main.tsx +++ b/aicard-web-oauth/src/main.tsx @@ -10,7 +10,7 @@ import { OAuthEndpointHandler } from './utils/oauth-endpoints' // DISABLED: This may interfere with BrowserOAuthClient // OAuthEndpointHandler.init() -ReactDOM.createRoot(document.getElementById('root')!).render( +ReactDOM.createRoot(document.getElementById('comment-atproto')!).render( diff --git a/aicard-web-oauth/vite.config.ts b/aicard-web-oauth/vite.config.ts index 0707304..3cf15c7 100644 --- a/aicard-web-oauth/vite.config.ts +++ b/aicard-web-oauth/vite.config.ts @@ -27,11 +27,55 @@ export default defineConfig(({ mode }) => { console.log(`Updated client-metadata.json with host: ${host}`) } } + }, + // Generate standalone index.html for testing + { + name: 'generate-standalone-html', + writeBundle() { + // Generate standalone index.html for testing + const indexHtmlPath = path.resolve(__dirname, 'dist/index.html') + const indexHtmlContent = ` + + + + + ai.card OAuth Test + + + + + +
+ +` + fs.writeFileSync(indexHtmlPath, indexHtmlContent) + console.log('Generated standalone index.html for testing') + } } ], build: { // Keep console.log in production for debugging minify: 'esbuild', + rollupOptions: { + output: { + // Fixed filenames for ailog integration + entryFileNames: 'assets/comment-atproto.js', + chunkFileNames: 'assets/comment-atproto-[name].js', + assetFileNames: (assetInfo) => { + if (assetInfo.name && assetInfo.name.endsWith('.css')) { + return 'assets/comment-atproto.css'; + } + return 'assets/[name].[ext]'; + } + } + } }, esbuild: { drop: [], // Don't drop console.log