refactor: webpack config (#11421)

This commit is contained in:
forehalo
2025-04-03 11:55:56 +00:00
parent 565d7b2b1e
commit c8d22d97d5
51 changed files with 766 additions and 547 deletions

View File

@@ -12,7 +12,8 @@
"./workspace": "./src/workspace.ts",
"./workspace/legacy-cloud": "./src/workspace/legacy-cloud/index.ts",
"./filter": "./src/filter.ts",
"./blocksuite": "./src/blocksuite/index.ts"
"./blocksuite": "./src/blocksuite/index.ts",
"./worker": "./src/worker.ts"
},
"peerDependencies": {
"@affine/templates": "workspace:*",

View File

@@ -17,6 +17,7 @@ export function setupGlobal() {
isMobile: false,
isSelfHosted: false,
publicPath: '/',
workerPath: '/js/',
};
if (globalThis.navigator) {

7
packages/common/env/src/worker.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
export function getWorkerUrl(name: string) {
if (BUILD_CONFIG.debug && !name.endsWith('.worker.js')) {
throw new Error(`worker should be named with '.worker.js', get ${name}`);
}
return environment.workerPath + name + '?v=' + BUILD_CONFIG.appVersion;
}