Repository navigation
Configure the section worker URL and warn when it fails to start - #345
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
InventivetalentDev
marked this pull request as ready for review
October 21, 2026 19:10
…test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Browser pages can tell MineRender where to load the world section worker from, and a failed worker start is no longer silent.
registerBrowserEnv({ sectionWorker })andnew BrowserEnv({ sectionWorker })accept a worker URL (string orURL) or a function that returns aWorker. Without the option,BrowserEnv.createWorkerkeeps the literalnew Worker(new URL("./section.worker.mjs", import.meta.url), { type: "module" })that bundlers detect.BrowserEnvlogs a warning that sections build on the main thread and names the option. The worker'serrorandmessageerrorevents log the same fallback through theSectionWorkerlogger. No warning is logged when the page has noWorkerglobal.minerender/section.workerresolves todist/browser/esm/env/browser/section.worker.mjs, so build scripts can copy the file without a deep path.BrowserEnvOptionsis exported from the browser entry.reference/platforms.mddescribes copying the worker and callingregisterBrowserEnv;reference/concepts.mdand AGENTS.md mention the option.Why
The CommonJS and script-tag builds have no
import.meta.url, and some bundlers do not emit the worker file. Those pages fell back to synchronous section builds without any message, and there was no supported way to point them at a copied worker file.Risk
Low. The option is additive and the default code path is unchanged. Pages that already fall back without a worker now log one warning, for example the
apps/webdemos, which bundle without the worker file.Testing
yarn workspace minerender typecheck,yarn build:lib,yarn workspace minerender test:package: pass. The builtBrowserEnv.mjsstill contains the literal worker URL once.yarn test: 835 tests pass, including the newBrowserEnv.test.ts(URL, function, failed start, noWorkerglobal,registerBrowserEnv) and theSectionMesh.test.tswarning checks.MineRender.registerBrowserEnv({ sectionWorker })the worker started and no warning was logged; without it, the page logged the new warning and built sections on the main thread.Note
AI-assisted.