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( <React.StrictMode> <BrowserRouter> <Routes> 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 = `<!DOCTYPE html> +<html lang="ja"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>ai.card OAuth Test</title> + <style> + body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + background-color: #0a0a0a; + color: #ffffff; + } + </style> + <script type="module" crossorigin src="/assets/comment-atproto.js"></script> + <link rel="stylesheet" crossorigin href="/assets/comment-atproto.css"> + </head> + <body> + <div id="comment-atproto"></div> + </body> +</html>` + 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