-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.tsx
42 lines (33 loc) · 932 Bytes
/
main.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { App } from "./app/App.tsx";
import { i18n } from "./modules/i18n";
import "./index.css";
import { isDevelopment, isProduction } from "./utils";
// to use Cypress.env in e2e environment
declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface Window {
Cypress?: { env: (key: string) => string };
}
}
async function setupApp() {
await i18n.configure();
if (isDevelopment || isProduction) {
const mocker = await import("./mocker/index.ts");
await mocker.runServer();
}
return Promise.resolve();
}
const root = createRoot(document.getElementById("root")!);
setupApp()
.then(() => {
root.render(
<StrictMode>
<App />
</StrictMode>
);
})
.catch((error) => {
console.error("Something went wrong in setting up app", error);
});