You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/web/src/index.tsx

32 lines
933 B
TypeScript

import './init';
import './dev';
import React from 'react';
import { createRoot } from 'react-dom/client';
import { App } from './App';
import { initPlugins } from './plugin/loader';
import { installServiceWorker } from './utils/sw-helper';
import { showErrorToasts, t } from 'tailchat-shared';
import { recordMeasure } from './utils/measure-helper';
import { postMessageEvent } from './utils/event-helper';
import './styles';
installServiceWorker();
// 先加载插件再开启应用
recordMeasure('initPluginsStart');
initPlugins()
.then(() => {
recordMeasure('initPluginsEnd');
postMessageEvent('loaded');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const root = createRoot(document.querySelector('#app')!);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
})
.catch(() => {
showErrorToasts(t('MiniStar 应用初始化失败'));
});