From a87d2cf1bdda32c363b8777fc0374c4f56502434 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Wed, 7 Jan 2026 20:46:22 -0500 Subject: [PATCH] fix: use pre-bundled wwobjloader2 worker for production builds (#7879) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary The unbundled worker from 'wwobjloader2/worker' has ES module imports that fail in production builds because Vite's ?url suffix doesn't bundle dependencies. Switch to 'wwobjloader2/bundle/worker/module' which is self-contained with all dependencies included. Fixes OBJ loading failing in production with Worker error events. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7879-fix-use-pre-bundled-wwobjloader2-worker-for-production-builds-2e16d73d365081f4a485c993852be1d3) by [Unito](https://www.unito.io) --- src/extensions/core/load3d/LoaderManager.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extensions/core/load3d/LoaderManager.ts b/src/extensions/core/load3d/LoaderManager.ts index 03002d661..3a4db5a3d 100644 --- a/src/extensions/core/load3d/LoaderManager.ts +++ b/src/extensions/core/load3d/LoaderManager.ts @@ -6,7 +6,9 @@ import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader' import { PLYLoader } from 'three/examples/jsm/loaders/PLYLoader' import { STLLoader } from 'three/examples/jsm/loaders/STLLoader' import { MtlObjBridge, OBJLoader2Parallel } from 'wwobjloader2' -import OBJLoader2WorkerUrl from 'wwobjloader2/worker?url' +// Use pre-bundled worker module (has all dependencies included) +// The unbundled 'wwobjloader2/worker' has ES imports that fail in production builds +import OBJLoader2WorkerUrl from 'wwobjloader2/bundle/worker/module?url' import { t } from '@/i18n' import { useSettingStore } from '@/platform/settings/settingStore'