mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor: webpack config (#11421)
This commit is contained in:
@@ -12,6 +12,7 @@ import { PopupWindowProvider } from '@affine/core/modules/url';
|
||||
import { configureBrowserWorkbenchModule } from '@affine/core/modules/workbench';
|
||||
import { configureBrowserWorkspaceFlavours } from '@affine/core/modules/workspace-engine';
|
||||
import createEmotionCache from '@affine/core/utils/create-emotion-cache';
|
||||
import { getWorkerUrl } from '@affine/env/worker';
|
||||
import { StoreManagerClient } from '@affine/nbstore/worker/client';
|
||||
import { CacheProvider } from '@emotion/react';
|
||||
import { Framework, FrameworkRoot, getCurrentStore } from '@toeverything/infra';
|
||||
@@ -23,19 +24,16 @@ const cache = createEmotionCache();
|
||||
|
||||
let storeManagerClient: StoreManagerClient;
|
||||
|
||||
const workerUrl = getWorkerUrl('nbstore.worker.js');
|
||||
|
||||
if (
|
||||
window.SharedWorker &&
|
||||
localStorage.getItem('disableSharedWorker') !== 'true'
|
||||
) {
|
||||
const worker = new SharedWorker(
|
||||
new URL(/* webpackChunkName: "nbstore" */ './nbstore.ts', import.meta.url),
|
||||
{ name: 'affine-shared-worker' }
|
||||
);
|
||||
const worker = new SharedWorker(workerUrl);
|
||||
storeManagerClient = new StoreManagerClient(new OpClient(worker.port));
|
||||
} else {
|
||||
const worker = new Worker(
|
||||
new URL(/* webpackChunkName: "nbstore" */ './nbstore.ts', import.meta.url)
|
||||
);
|
||||
const worker = new Worker(workerUrl);
|
||||
storeManagerClient = new StoreManagerClient(new OpClient(worker));
|
||||
}
|
||||
window.addEventListener('beforeunload', () => {
|
||||
|
||||
Reference in New Issue
Block a user