Skip to content

Use separate browser/node entrypoints instead of runtime environment detection#3121

Merged
minestarks merged 3 commits intomainfrom
minestarks/worker-import
Apr 15, 2026
Merged

Use separate browser/node entrypoints instead of runtime environment detection#3121
minestarks merged 3 commits intomainfrom
minestarks/worker-import

Conversation

@minestarks
Copy link
Copy Markdown
Member

This PR takes us back to splitting the package entrypoint using the exports field's conditional "browser" / "node" conditions:

  • browser.ts — re-exports main.ts as-is (browsers natively support Worker with type: "classic")
  • node.ts — polyfills globalThis.Worker via web-worker and calls setWorkerType("module") before re-exporting main.ts

The isBrowser runtime detection is removed entirely. Instead, the worker type is passed explicitly as a parameter to createProxy.

Comment thread source/npm/qsharp/src/browser.ts Outdated
Comment thread source/npm/qsharp/src/node.ts
- Remove redundant browser.ts wrapper
- Update package.json exports to use main.js for browser
- Update main.ts header comment
@minestarks minestarks enabled auto-merge April 15, 2026 19:37
@minestarks minestarks added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit 4ff6e40 Apr 15, 2026
12 checks passed
@minestarks minestarks deleted the minestarks/worker-import branch April 15, 2026 20:43
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.

3 participants