entry.tsx 625 B

123456789101112131415161718192021222324252627
  1. // @refresh reload
  2. import { render } from "solid-js/web"
  3. import { App } from "@/app"
  4. import { Platform, PlatformProvider } from "@/context/platform"
  5. const root = document.getElementById("root")
  6. if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
  7. throw new Error(
  8. "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?",
  9. )
  10. }
  11. const platform: Platform = {
  12. platform: "web",
  13. openLink(url: string) {
  14. window.open(url, "_blank")
  15. },
  16. }
  17. render(
  18. () => (
  19. <PlatformProvider value={platform}>
  20. <App />
  21. </PlatformProvider>
  22. ),
  23. root!,
  24. )