WebStudio/src/index.tsx

47 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-11-26 10:01:26 +00:00
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorkerLoader";
2019-11-12 12:21:05 +00:00
2021-04-25 08:48:37 +00:00
import * as Sentry from "@sentry/react";
import { Integrations } from "@sentry/tracing";
2020-04-10 10:57:03 +00:00
2021-04-25 08:48:37 +00:00
import store from "./store";
2019-11-26 10:01:26 +00:00
import { Provider } from "react-redux";
2021-04-25 08:48:37 +00:00
function getEnvironment() {
// this is only set when building for prod
if (process.env.REACT_APP_PRODUCTION === "true") {
return "production";
}
if (process.env.NODE_ENV === "production") {
return "webstudio-dev";
}
return process.env.NODE_ENV;
2020-04-12 08:13:41 +00:00
}
2020-04-10 10:57:03 +00:00
2021-04-25 08:48:37 +00:00
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_PUBLIC_DSN,
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 1.0,
environment: getEnvironment(),
release: process.env.REACT_APP_VERSION + "-" + process.env.REACT_APP_GIT_SHA,
2021-04-25 08:48:37 +00:00
normalizeDepth: 10,
});
2019-11-26 10:01:26 +00:00
function render() {
2020-04-19 13:47:19 +00:00
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById("root")
);
2019-11-26 10:01:26 +00:00
}
render();
2019-11-12 12:21:05 +00:00
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.register();