fix config vite
Some checks failed
Deploy ailog / build-and-deploy (push) Failing after 11m33s

This commit is contained in:
2025-06-11 15:16:06 +09:00
parent bebd6a61eb
commit b2fa06d5fa
2 changed files with 45 additions and 1 deletions

View File

@ -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>

View File

@ -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