Run the worker prelude ahead of Cesium's own workers script

Cesium's script sets CESIUM_WORKERS itself when it loads, so the panel's
combined workers script was never used, and neither was the embedded
terrain-heights file: the worker still requested it from the panel
page's site. The panel build now writes only the prelude, and the panel
puts it ahead of whatever Cesium assigns to CESIUM_WORKERS. The separate
esbuild bundle of Cesium's workers is gone.
This commit is contained in:
Sameh Khamis committed 2026-10-02 18:29:42 -07:00
1 parent 9e5ef78f91
commit e82ab7440d
6 files changed
+38 -65

No files matched your search

+5 -16
View File
@@ -6,16 +6,18 @@ import test from 'node:test';
import * as PANEL_PATHS from '../tools/globePanel.js';
import {
PANEL_BASE,
PANEL_WORKERS_PATH,
PANEL_WORKER_PRELUDE_PATH,
panelBuildConfig,
panelBuildPlugin,
workerFilesPrelude,
workersEntrySource,
} from '../../build/panel.js';
test('the panel loads the paths the panel build writes', () => {
assert.equal(PANEL_BASE, PANEL_PATHS.PANEL_BASE);
assert.equal(PANEL_WORKERS_PATH, PANEL_PATHS.PANEL_WORKERS_PATH);
assert.equal(
PANEL_WORKER_PRELUDE_PATH,
PANEL_PATHS.PANEL_WORKER_PRELUDE_PATH,
);
});
test('the panel build is one script and one stylesheet under /panel/', () => {
@@ -30,19 +32,6 @@ test('the panel build is one script and one stylesheet under /panel/', () => {
assert.equal(config.build.chunkSizeWarningLimit, 1500);
});
test("Cesium's workers load lazily from one script", () => {
const source = workersEntrySource(['createGeometry', 'decodeDraco'], '/w');
assert.match(source, /^self\.CesiumWorkers = \{/);
assert.match(
source,
/"createGeometry": \(\) => import\("\/w\/createGeometry\.js"\)/,
);
assert.match(
source,
/"decodeDraco": \(\) => import\("\/w\/decodeDraco\.js"\)/,
);
});
test('the dev server serves the panel build and nothing outside it', async () => {
const root = await mkdtemp(join(tmpdir(), 'panel-build-'));
try {