mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
I suspect HMR does not working properly on dev because we have multiple entries. One relative issue: https://github.com/webpack/webpack-dev-server/issues/2792/ I think we do not need multiple entries for polyfills & plugins after all. They could be in the same chunk, and could be later optimized through splitChunks option. `ses.ts` is changed to `ses-lockdown.ts` because `ses.ts` does not pass circular dependency check by madge. I haven't looked through the real root cause though. See https://github.com/pahen/madge/issues/355
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import './polyfill/ses-lockdown';
|
|
import './polyfill/intl-segmenter';
|
|
|
|
import { WorkspaceFallback } from '@affine/component/workspace';
|
|
import { assertExists } from '@blocksuite/global/utils';
|
|
import { getCurrentStore } from '@toeverything/infra/atom';
|
|
import { StrictMode, Suspense } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
|
|
import { bootstrapPluginSystem } from './bootstrap/register-plugins';
|
|
import { performanceLogger } from './shared';
|
|
|
|
const performanceMainLogger = performanceLogger.namespace('main');
|
|
async function main() {
|
|
performanceMainLogger.info('start');
|
|
const { setup } = await import('./bootstrap/setup');
|
|
|
|
const rootStore = getCurrentStore();
|
|
performanceMainLogger.info('setup start');
|
|
await setup(rootStore);
|
|
performanceMainLogger.info('setup done');
|
|
|
|
bootstrapPluginSystem(rootStore).catch(err => {
|
|
console.error('Failed to bootstrap plugin system', err);
|
|
});
|
|
|
|
performanceMainLogger.info('import app');
|
|
const { App } = await import('./app');
|
|
const root = document.getElementById('app');
|
|
assertExists(root);
|
|
|
|
performanceMainLogger.info('render app');
|
|
createRoot(root).render(
|
|
<StrictMode>
|
|
<Suspense fallback={<WorkspaceFallback key="AppLoading" />}>
|
|
<App />
|
|
</Suspense>
|
|
</StrictMode>
|
|
);
|
|
}
|
|
|
|
main().catch(err => {
|
|
console.error('Failed to bootstrap app', err);
|
|
});
|