Initial commit: full-stack Bun + Elysia + React template
Elysia.js API with session-based auth (email/password + Google OAuth), role system (USER/ADMIN/SUPER_ADMIN), Prisma + PostgreSQL, React 19 with Mantine UI, TanStack Router, dark theme, and comprehensive test suite (unit, integration, E2E with Lightpanda). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
src/frontend.tsx
Normal file
34
src/frontend.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { App } from './frontend/App'
|
||||
|
||||
// DevInspector hanya di-import saat dev (tree-shaken di production)
|
||||
const InspectorWrapper = import.meta.env?.DEV
|
||||
? (await import('./frontend/DevInspector')).DevInspector
|
||||
: ({ children }: { children: ReactNode }) => <>{children}</>
|
||||
|
||||
// Remove splash screen after React mounts
|
||||
function removeSplash() {
|
||||
const splash = document.getElementById('splash')
|
||||
if (splash) {
|
||||
splash.classList.add('fade-out')
|
||||
setTimeout(() => splash.remove(), 300)
|
||||
}
|
||||
}
|
||||
|
||||
const elem = document.getElementById('root')!
|
||||
const app = (
|
||||
<InspectorWrapper>
|
||||
<App />
|
||||
</InspectorWrapper>
|
||||
)
|
||||
|
||||
// HMR-safe: reuse root agar React state preserved saat hot reload
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.data.root ??= createRoot(elem)
|
||||
import.meta.hot.data.root.render(app)
|
||||
} else {
|
||||
createRoot(elem).render(app)
|
||||
}
|
||||
|
||||
removeSplash()
|
||||
Reference in New Issue
Block a user