entry.tsx 742 B

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