Skip to content

fix: handle lynx.getJSModule error on web platform #1830

Merged
PupilTong merged 4 commits intolynx-family:mainfrom
PupilTong:p/hw/rspeedy-remove-websocket-for-web
Sep 25, 2025
Merged

fix: handle lynx.getJSModule error on web platform #1830
PupilTong merged 4 commits intolynx-family:mainfrom
PupilTong:p/hw/rspeedy-remove-websocket-for-web

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Sep 24, 2025

#1806

Summary by CodeRabbit

  • New Features
    • Environment-aware dev server client setup for smoother web development.
  • Bug Fixes
    • Resolved a web runtime error causing “getJSModule is not a function” during development.
    • Prevented unnecessary WebSocket injection on web to avoid startup issues.
  • Tests
    • Added coverage to verify correct client configuration and absence of WebSocket injection on web.
  • Chores
    • Published a patch release for @lynx-js/rspeedy.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 24, 2025

🦋 Changeset detected

Latest commit: 167d169

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@lynx-js/rspeedy Patch
create-rspeedy Patch
upgrade-rspeedy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 24, 2025

📝 Walkthrough

Walkthrough

Adds a patch changeset and updates the dev plugin to split HMR ProvidePlugin entries: always register the dev-server client entry and register a Lynx-only WebSocket transport under a new plugin path when running in a Lynx environment; tests updated to reflect these behaviors and assertion changes.

Changes

Cohort / File(s) Summary
Release & Versioning
.changeset/crazy-jeans-hunt.md
Adds a patch changeset for @lynx-js/rspeedy describing a fix for the runtime error lynx.getJSModule is not a function on Web.
Core Plugin Logic
packages/rspeedy/core/src/plugins/dev.plugin.ts
Adds isLynx(environment) detection; renames primary HMR provide plugin to lynx.hmr.provide.dev_server_client and moves WebSocket transport injection into a conditional lynx.hmr.provide.websocket plugin registered only when Lynx is detected.
Tests
packages/rspeedy/core/test/plugins/dev.plugin.test.ts
Replaces toBeCalledWith with toHaveBeenCalledWith in ProvidePlugin assertions and adds a test ensuring no WebSocket class is injected for web environments (only the dev-server client mapping is provided).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • colinaaa
  • Sherry-hue

Poem

I nibble bits and hop through trees,
Dev client hops in with nimble ease.
Web skips the socket, Lynx keeps the thread,
Patch sewn neat — carrots for the spread! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change by specifying the fix for the lynx.getJSModule error on the web platform, directly reflecting the pull request’s intent and avoiding extraneous detail.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1)

102-121: Fix casing in test title ("WebSocket").

Prefer the canonical “WebSocket” spelling.

-  test('no Websocket class injected for web', async () => {
+  test('no WebSocket class injected for web', async () => {
packages/rspeedy/core/src/plugins/dev.plugin.ts (1)

153-177: Env‑gated ProvidePlugin config is correct; consider de‑duplicating the client entry.

You can avoid duplicating webpack_dev_server_client by using a single object with a conditional spread.

-            .use(ProvidePlugin, [
-              isLynx(environment) ? {
-                WebSocket: [
-                  options?.client?.websocketTransport ?? require.resolve('@lynx-js/websocket'),
-                  'default',
-                ],
-                __webpack_dev_server_client__: [
-                  require.resolve(
-                    './client/hmr/WebSocketClient.js',
-                    {
-                      paths: [rspeedyDir],
-                    },
-                  ),
-                  'default'
-                ],
-              } : {
-                __webpack_dev_server_client__: [
-                  require.resolve(
-                    './client/hmr/WebSocketClient.js',
-                    {
-                      paths: [rspeedyDir],
-                    },
-                  ),
-                  'default'
-                ],
-              }
-            ])
+            .use(ProvidePlugin, [
+              {
+                ...(isLynx(environment) ? {
+                  WebSocket: [
+                    options?.client?.websocketTransport ?? require.resolve('@lynx-js/websocket'),
+                    'default',
+                  ],
+                } : {}),
+                __webpack_dev_server_client__: [
+                  require.resolve('./client/hmr/WebSocketClient.js', {
+                    paths: [rspeedyDir],
+                  }),
+                  'default',
+                ],
+              }
+            ])
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6411f84 and 6f38f0c.

📒 Files selected for processing (3)
  • .changeset/crazy-jeans-hunt.md (1 hunks)
  • packages/rspeedy/core/src/plugins/dev.plugin.ts (3 hunks)
  • packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, always generate a changeset and commit the resulting markdown file(s)

Files:

  • .changeset/crazy-jeans-hunt.md
🧠 Learnings (7)
📓 Common learnings
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/core/test/plugins/dev.plugin.test.ts
  • packages/rspeedy/core/src/plugins/dev.plugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • .changeset/crazy-jeans-hunt.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • .changeset/crazy-jeans-hunt.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • .changeset/crazy-jeans-hunt.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • .changeset/crazy-jeans-hunt.md
  • packages/rspeedy/core/src/plugins/dev.plugin.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • .changeset/crazy-jeans-hunt.md
  • packages/rspeedy/core/src/plugins/dev.plugin.ts
🧬 Code graph analysis (2)
packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1)
packages/rspeedy/core/test/createStubRspeedy.ts (1)
  • createStubRspeedy (20-64)
packages/rspeedy/core/src/plugins/dev.plugin.ts (1)
packages/rspeedy/core/src/utils/is-lynx.ts (1)
  • isLynx (7-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
.changeset/crazy-jeans-hunt.md (1)

5-5: Changeset LGTM; scope is correct.

Patch entry for @lynx-js/rspeedy with concise note is appropriate for this fix.

packages/rspeedy/core/src/plugins/dev.plugin.ts (1)

15-15: LGTM: importing isLynx for env gating.

This keeps the web build free of Lynx-only shims.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@relativeci
Copy link
Copy Markdown

relativeci bot commented Sep 24, 2025

React Example

#5528 Bundle Size — 237.56KiB (0%).

5eb736c(current) vs 909a842 main#5525(baseline)

Bundle metrics  no changes
                 Current
#5528
     Baseline
#5525
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 166 166
No change  Duplicate Modules 68 68
No change  Duplicate Code 46.81% 46.81%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5528
     Baseline
#5525
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.8KiB 91.8KiB

Bundle analysis reportBranch PupilTong:p/hw/rspeedy-remove-we...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Sep 24, 2025

Web Explorer

#5523 Bundle Size — 365.44KiB (0%).

5eb736c(current) vs 909a842 main#5520(baseline)

Bundle metrics  no changes
                 Current
#5523
     Baseline
#5520
No change  Initial JS 145.71KiB 145.71KiB
No change  Initial CSS 32KiB 32KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
No change  Modules 219 219
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.37% 3.37%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5523
     Baseline
#5520
No change  JS 239.42KiB 239.42KiB
No change  Other 94.02KiB 94.02KiB
No change  CSS 32KiB 32KiB

Bundle analysis reportBranch PupilTong:p/hw/rspeedy-remove-we...Project dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Sep 24, 2025

CodSpeed Performance Report

Merging #1830 will degrade performances by 5.51%

Comparing PupilTong:p/hw/rspeedy-remove-websocket-for-web (5eb736c) with main (9ab108f)

Summary

❌ 1 regression
✅ 52 untouched
⏩ 3 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
basic-performance-div-100 5.7 ms 6.1 ms -5.51%

Footnotes

  1. 3 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.

Comment thread packages/rspeedy/core/src/plugins/dev.plugin.ts Outdated
Comment thread .changeset/crazy-jeans-hunt.md Outdated
@PupilTong PupilTong requested a review from colinaaa September 25, 2025 04:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a59ad6 and 0dce333.

📒 Files selected for processing (1)
  • packages/rspeedy/core/src/plugins/dev.plugin.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/core/src/plugins/dev.plugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/core/src/plugins/dev.plugin.ts
🧬 Code graph analysis (1)
packages/rspeedy/core/src/plugins/dev.plugin.ts (1)
packages/rspeedy/core/src/utils/is-lynx.ts (1)
  • isLynx (7-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)

Comment thread packages/rspeedy/core/src/plugins/dev.plugin.ts
PupilTong and others added 4 commits September 25, 2025 14:56
Co-authored-by: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
Signed-off-by: Haoyang Wang <12288479+PupilTong@users.noreply.github.com>
@PupilTong PupilTong force-pushed the p/hw/rspeedy-remove-websocket-for-web branch from 167d169 to 5eb736c Compare September 25, 2025 06:56
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0dce333 and 5eb736c.

📒 Files selected for processing (3)
  • .changeset/crazy-jeans-hunt.md (1 hunks)
  • packages/rspeedy/core/src/plugins/dev.plugin.ts (3 hunks)
  • packages/rspeedy/core/test/plugins/dev.plugin.test.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/crazy-jeans-hunt.md
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/core/src/plugins/dev.plugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/core/src/plugins/dev.plugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/core/src/plugins/dev.plugin.ts
  • packages/rspeedy/core/test/plugins/dev.plugin.test.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • packages/rspeedy/core/src/plugins/dev.plugin.ts
🧬 Code graph analysis (2)
packages/rspeedy/core/src/plugins/dev.plugin.ts (1)
packages/rspeedy/core/src/utils/is-lynx.ts (1)
  • isLynx (7-11)
packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1)
packages/rspeedy/core/test/createStubRspeedy.ts (1)
  • createStubRspeedy (20-64)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1)

76-84: toHaveBeenCalledWith matcher aligns with Vitest API.

Thanks for migrating to the modern matcher; it keeps the assertion style consistent with Vitest/Jest conventions.

packages/rspeedy/core/src/plugins/dev.plugin.ts (1)

15-15: Don't drop the WebSocket polyfill for node-side bundles.

Gating the WebSocket ProvidePlugin behind isLynx(environment) removes the polyfill for environments like Node (where environment.name === 'node'), breaking HMR there. The intent was to skip the injection only for the web target that lacks lynx.getJSModule, so please invert the predicate to “not web” instead of “is Lynx” and import the corresponding helper. (Same concern noted earlier in review.)

-import { isLynx } from '../utils/is-lynx.js'
+import { isWeb } from '../utils/is-web.js'
@@
-        if (isLynx(environment)) {
+        if (!isWeb(environment)) {

Also applies to: 166-175

Comment thread packages/rspeedy/core/test/plugins/dev.plugin.test.ts
@PupilTong PupilTong merged commit df40a0a into lynx-family:main Sep 25, 2025
111 of 118 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Rspeedy Sep 25, 2025
PupilTong added a commit to PupilTong/lynx-stack that referenced this pull request Sep 25, 2025
lynx-family#1806

<!--
  Thank you for submitting a pull request!

We appreciate the time and effort you have invested in making these
changes. Please ensure that you provide enough information to allow
others to review your pull request.

Upon submission, your pull request will be automatically assigned with
reviewers.

If you want to learn more about contributing to this project, please
visit:
https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md.
-->

<!-- The AI summary below will be auto-generated - feel free to replace
it with your own. -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- New Features
- Environment-aware dev server client setup for smoother web
development.
- Bug Fixes
- Resolved a web runtime error causing “getJSModule is not a function”
during development.
- Prevented unnecessary WebSocket injection on web to avoid startup
issues.
- Tests
- Added coverage to verify correct client configuration and absence of
WebSocket injection on web.
- Chores
  - Published a patch release for @lynx-js/rspeedy.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

## Checklist

<!--- Check and mark with an "x" -->

- [x] Tests updated (or not required).
- [ ] Documentation updated (or not required).
- [x] Changeset added, and when a BREAKING CHANGE occurs, it needs to be
clearly marked (or not required).

---------

Signed-off-by: Haoyang Wang <12288479+PupilTong@users.noreply.github.com>
Co-authored-by: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
colinaaa pushed a commit that referenced this pull request Sep 27, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/rspeedy@0.11.4

### Patch Changes

- Bump Rsbuild v1.5.12 with Rspack v1.5.7.
([#1708](#1708))

- Fix the "lynx.getJSModule is not a function" error on Web platform
([#1830](#1830))

- Support `server.compress`
([#1799](#1799))

- Support `server.cors`
([#1808](#1808))

## @lynx-js/qrcode-rsbuild-plugin@0.4.2

### Patch Changes

- Bump @clack/prompts v1.0.0-alpha.5.
([#1809](#1809))

## @lynx-js/web-constants@0.17.1

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/web-worker-rpc@0.17.1

## @lynx-js/web-core@0.17.1

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/web-constants@0.17.1
    -   @lynx-js/web-mainthread-apis@0.17.1
    -   @lynx-js/web-worker-rpc@0.17.1
    -   @lynx-js/web-worker-runtime@0.17.1

## @lynx-js/web-mainthread-apis@0.17.1

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/web-constants@0.17.1
    -   @lynx-js/web-style-transformer@0.17.1

## @lynx-js/web-rsbuild-server-middleware@0.17.1

### Patch Changes

- chore: initial release with current version web platform
([#1807](#1807))

## @lynx-js/web-worker-runtime@0.17.1

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/web-constants@0.17.1
    -   @lynx-js/web-mainthread-apis@0.17.1
    -   @lynx-js/web-worker-rpc@0.17.1

## create-rspeedy@0.11.4



## upgrade-rspeedy@0.11.4



## @lynx-js/web-core-server@0.17.1



## @lynx-js/web-style-transformer@0.17.1



## @lynx-js/web-worker-rpc@0.17.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants