import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'

async function bootstrap() {
  // Checked directly (not via the `env` wrapper) so Vite/Rollup can statically
  // inline this and drop the entire mocks chunk from a real production build.
  if (import.meta.env.VITE_USE_MOCKS === 'true') {
    const { installMockFetch } = await import('@/mocks/fetchMock')
    installMockFetch()
  }

  createRoot(document.getElementById('root')!).render(
    <StrictMode>
      <App />
    </StrictMode>,
  )
}

bootstrap()
