Skip to content

Add single-threaded WASM fallback to remove COOP/COEP header requirement#3

Open
coryrylan wants to merge 1 commit into
mainfrom
claude/web-component-headers-0rz8hr
Open

Add single-threaded WASM fallback to remove COOP/COEP header requirement#3
coryrylan wants to merge 1 commit into
mainfrom
claude/web-component-headers-0rz8hr

Conversation

@coryrylan

Copy link
Copy Markdown
Owner

The threaded WASM build requires SharedArrayBuffer and therefore COOP/COEP
response headers, which blocks CDN/static deployments that cannot set
server headers. This adds a second, single-threaded build variant that the
loader selects automatically at runtime when SharedArrayBuffer is
unavailable, so the web component works with zero server configuration.

  • scripts/patch-build-usd-single-thread.py: verified patch that drops
    -pthread from the Autodesk fork's build_usd.py and passes
    -DEMSCRIPTEN_WITHOUT_PTHREAD=ON to oneTBB (supported by the pinned
    oneTBB v2021.12.0)
  • scripts/build-wasm.sh: builds both variants (threaded -> wasm/,
    single-threaded -> wasm/st/), selectable via VARIANTS env var
  • src/utils.ts: feature-detect SharedArrayBuffer and load wasm/st/ as a
    fallback; fail with an actionable error instead of a cryptic one
  • README.md / BUILDING.md: document the two variants, mark the headers as
    optional (performance), update the stale oneTBB blocker notes, and fix
    the coi-serviceworker link to the canonical repo

The wasm/st/ artifacts still need to be generated with npm run build:wasm
(Docker) and committed; until then non-isolated pages get a descriptive
load error.

https://claude.ai/code/session_01FT2aFG1YER768D3FRELkYd

The threaded WASM build requires SharedArrayBuffer and therefore COOP/COEP
response headers, which blocks CDN/static deployments that cannot set
server headers. This adds a second, single-threaded build variant that the
loader selects automatically at runtime when SharedArrayBuffer is
unavailable, so the web component works with zero server configuration.

- scripts/patch-build-usd-single-thread.py: verified patch that drops
  -pthread from the Autodesk fork's build_usd.py and passes
  -DEMSCRIPTEN_WITHOUT_PTHREAD=ON to oneTBB (supported by the pinned
  oneTBB v2021.12.0)
- scripts/build-wasm.sh: builds both variants (threaded -> wasm/,
  single-threaded -> wasm/st/), selectable via VARIANTS env var
- src/utils.ts: feature-detect SharedArrayBuffer and load wasm/st/ as a
  fallback; fail with an actionable error instead of a cryptic one
- README.md / BUILDING.md: document the two variants, mark the headers as
  optional (performance), update the stale oneTBB blocker notes, and fix
  the coi-serviceworker link to the canonical repo

The wasm/st/ artifacts still need to be generated with `npm run build:wasm`
(Docker) and committed; until then non-isolated pages get a descriptive
load error.

https://claude.ai/code/session_01FT2aFG1YER768D3FRELkYd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants