mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 02:21:49 +03:00
5e56ec65e3
packages/frontend/core/src hooks -> components/hooks atoms -> components/atoms layouts -> components/layouts providers -> components/providers mixpanel -> @affine/track ~~shared~~ ~~unexpected-application-state~~
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import './setup';
|
|
|
|
import {
|
|
init,
|
|
reactRouterV6BrowserTracingIntegration,
|
|
setTags,
|
|
} from '@sentry/react';
|
|
import { StrictMode, useEffect } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import {
|
|
createRoutesFromChildren,
|
|
matchRoutes,
|
|
useLocation,
|
|
useNavigationType,
|
|
} from 'react-router-dom';
|
|
|
|
import { App } from './app';
|
|
|
|
function main() {
|
|
if (BUILD_CONFIG.debug || window.SENTRY_RELEASE) {
|
|
// https://docs.sentry.io/platforms/javascript/guides/react/#configure
|
|
init({
|
|
dsn: process.env.SENTRY_DSN,
|
|
environment: process.env.BUILD_TYPE ?? 'development',
|
|
integrations: [
|
|
reactRouterV6BrowserTracingIntegration({
|
|
useEffect,
|
|
useLocation,
|
|
useNavigationType,
|
|
createRoutesFromChildren,
|
|
matchRoutes,
|
|
}),
|
|
],
|
|
});
|
|
setTags({
|
|
appVersion: BUILD_CONFIG.appVersion,
|
|
editorVersion: BUILD_CONFIG.editorVersion,
|
|
});
|
|
}
|
|
mountApp();
|
|
}
|
|
|
|
function mountApp() {
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
const root = document.getElementById('app')!;
|
|
createRoot(root).render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>
|
|
);
|
|
}
|
|
|
|
try {
|
|
main();
|
|
} catch (err) {
|
|
console.error('Failed to bootstrap app', err);
|
|
}
|