Skip to content

fix(worker): handle SharedWorker string name option - #15012

Merged
elecmonkey merged 4 commits into
mainfrom
fix/shared-worker-string-options
Jul 31, 2026
Merged

elecmonkey merged 4 commits into
mainfrom
fix/shared-worker-string-options

Conversation

@elecmonkey

@elecmonkey elecmonkey commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix the string name overload of SharedWorker.

Previously, Rspack transformed:

new SharedWorker(url, "chat");

into:

new SharedWorker(url, Object.assign({}, "chat", { type: "module" }));

This converted the string into an object without a name property, causing the SharedWorker name to be lost.

This PR handles the second argument based on its syntax:

  • Object literals keep the existing Object.assign behavior.
  • String literals are preserved for classic output and converted to { name: "chat", type: "module" } for module output.
  • Expressions whose type is unknown at compile time use a runtime check to distinguish strings from objects and are evaluated only once.

Since the SharedWorker flag and option kind jointly describe one rendering semantic, they are encoded together to keep add_dependencies within Clippy's argument limit.

The new behavior is limited to SharedWorker. Worker, Service Worker, Node.js Worker, and custom worker aliases are unchanged.

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (not required).

@elecmonkey

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 967ce20ed0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 4aff4e0 to fix: preserve context exports in rspack runtime mode (#15001) by harpsealjs

🙈 Size remains the same at 66.77MB

@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 552.1 KB 0 0
react-10k 5.6 MB 1.3 MB 0 0
react-1k 823.1 KB 217.0 KB 0 0
react-5k 2.7 MB 663.8 KB 0 0
ui-components 4.9 MB 1.4 MB 0 0

Generated by Rsdoctor GitHub Action

@elecmonkey
elecmonkey marked this pull request as ready for review July 30, 2026 17:46
@elecmonkey
elecmonkey requested a review from Timeless0911 July 30, 2026 18:03
@codspeed

codspeed Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 46 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing fix/shared-worker-string-options (4aff4e0) with main (5a52b06)

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@elecmonkey
elecmonkey requested a review from JSerFeng July 31, 2026 02:56
@elecmonkey
elecmonkey merged commit c05244a into main Jul 31, 2026
39 checks passed
@elecmonkey
elecmonkey deleted the fix/shared-worker-string-options branch July 31, 2026 07:57
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