Skip to content

fix: refactor hot update of style#1965

Merged
HuJean merged 4 commits intomainfrom
p/hujing/hmr-css
Dec 8, 2025
Merged

fix: refactor hot update of style#1965
HuJean merged 4 commits intomainfrom
p/hujing/hmr-css

Conversation

@HuJean
Copy link
Copy Markdown
Collaborator

@HuJean HuJean commented Nov 28, 2025

Closed #1955

Summary by CodeRabbit

  • New Features

    • Per-bundle .css.hot-update.json files for CSS hot-reload and bundle-splitting.
    • Template emission now receives per-entry names (entryNames).
  • Tests

    • Added end-to-end test cases and snapshots covering hot-update, bundle-splitting, and code-splitting scenarios.
  • Chores

    • Peer dependency bumped; dev tooling updated.
    • CODEOWNERS updated; note: template-plugin v0.10.0 required (breaking upgrade).

✏️ Tip: You can customize this high-level summary in your review settings.

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).

@HuJean HuJean requested a review from colinaaa as a code owner November 28, 2025 05:46
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 28, 2025

🦋 Changeset detected

Latest commit: 9012a82

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

This PR includes changesets to release 6 packages
Name Type
@lynx-js/css-extract-webpack-plugin Minor
@lynx-js/template-webpack-plugin Minor
@lynx-js/react-rsbuild-plugin Patch
@lynx-js/react-webpack-plugin Major
@lynx-js/react-alias-rsbuild-plugin Patch
@lynx-js/react-refresh-webpack-plugin Major

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 Nov 28, 2025

📝 Walkthrough

Walkthrough

Adds per-entry CSS hot-update JSON emission and runtime wiring, updates TemplatePlugin to pass entryNames, bumps two webpack plugins, and adds/updates tests and snapshots for bundle- and chunk-splitting hot-update behavior.

Changes

Cohort / File(s) Summary
Release metadata & ownership
\.changeset/violet-facts-notice.md, \.changeset/rotten-bikes-beg.md, CODEOWNERS
Adds changesets bumping @lynx-js/css-extract-webpack-plugin and @lynx-js/template-webpack-plugin (minor), notes breaking-change requirement for template plugin 0.10.0, and updates CODEOWNERS.
Package manifests
packages/webpack/css-extract-webpack-plugin/package.json, packages/webpack/template-webpack-plugin/package.json
Bumps peerDependency @lynx-js/template-webpack-plugin to ^0.10.0; adds css-loader to template plugin devDependencies.
CssExtract plugin core changes
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
Adds private hotUpdateFiles: Map<string,string>, computes per-entry .css.hot-update.json paths, emits per-entry hot-update JSON assets, and passes the map into the runtime module.
Runtime module API
packages/webpack/css-extract-webpack-plugin/src/...CSSHotUpdateRuntimeModule
Changes CSSHotUpdateRuntimeModule constructor from `(hash: string
CssExtract hot-update tests — bundle-splitting
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/*
Adds test fixtures (entry.js, lazy.js, common.js, entry.css, lazy.css), rspack/test configs, and snapshots asserting per-entry .css.hot-update.json files with expected base64 CSS content. (common.js exports minus; lazy.js exports add.)
CssExtract hot-update tests — chunk-splitting
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/*, .../index.js
Updates snapshots and tests to use new manifest naming (CURRENT_HASH → LAST_HASH and index/mainX .css.hot-update.json filenames) and updates snapshot sizes/entries accordingly.
Template plugin API & implementation
packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md, packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
Adds entryNames: string[] to TemplateHooks.beforeEmit payload and passes entryNames through the LynxTemplatePlugin encode/emission flow.
Template plugin tests — bundle & code-splitting with styles
packages/webpack/template-webpack-plugin/test/cases/*/with-style/*
Adds test fixtures (red/blue CSS, JS entries), rspack configs and test.config.cjs files to verify merged cssMap selectors across bundle- and code-splitting scenarios.
Snapshots
packages/webpack/css-extract-webpack-plugin/test/.../__snapshot__/*
Adds and updates multiple hot-update snapshots to reflect per-entry .css.hot-update.json naming, updated hashes, and sizes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Files needing extra attention:
    • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts — per-entry emit loop, lifecycle of hotUpdateFiles, and asset naming.
    • CSSHotUpdateRuntimeModule constructor change — ensure all instantiations and runtime wiring are consistent.
    • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts and etc/template-webpack-plugin.api.md — hook payload change and consumers.
    • Tests and snapshots — validate deterministic naming/hashes and updated expectations.

Possibly related PRs

Suggested reviewers

  • colinaaa
  • luhc228
  • gaoachao

Poem

🐇 I hopped through bundles, jsons in hand,
I mapped each entry across the land.
Tiny .css.hot-update files in a row,
Base64 carrots let the styles grow.
Hop, build, and cheer — updates on the go!

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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: refactor hot update of style' is directly related to the main objective: fixing CSS hot-update (HMR) when styles are split into chunks, as confirmed by linked issue #1955.
Linked Issues check ✅ Passed The PR successfully addresses issue #1955 by implementing per-entry CSS hot-update JSON generation with the hotUpdateFiles mechanism, enabling proper HMR when CSS is split into chunks.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing CSS hot-update for split chunks. CODEOWNERS updates and added CSS/JS test files are supporting changes within scope.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch p/hujing/hmr-css

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: 2

🧹 Nitpick comments (3)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (1)

68-71: Hot-update JSON basename update looks consistent; consider cleaning up logging

The switch to index.${prevHash}.css.hot-update.json for both the filesystem check and __non_webpack_require__ import is consistent and keeps the test aligned with the new per-entry naming.

You can optionally remove the console.log(content) below to keep test output clean.

Also applies to: 86-89

packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js (1)

24-24: Translate comment to English for consistency.

The comment at line 24 is in Chinese. For consistency with the rest of the codebase, please use English for code comments.

Apply this diff:

-      chunkFilename: 'css/[name].[contenthash:8].css', // 关键:配置 chunk CSS 文件名
+      chunkFilename: 'css/[name].[contenthash:8].css', // Key: Configure chunk CSS filename
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

283-298: Refactor to eliminate duplicate path computation.

Lines 285-288 and 293-296 compute the same hot-update path. The hotUpdatePath variable can be reused in the return statement.

Apply this diff:

 const cssHotUpdateList = [...asyncChunks, initialChunk].map((
   [chunkName, cssHotUpdatePath],
 ) => {
   // use hash of previous compilation cause CSSHotUpdateRuntimeModule can not get hash immediately
   const hotUpdatePath = cssHotUpdatePath!.replace(
     '.css',
     `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
   );
   // save all hot update file info
   this.hotUpdateFiles.set(chunkName!, hotUpdatePath);
   return [
     chunkName!,
-    cssHotUpdatePath!.replace(
-      '.css',
-      `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
-    ),
+    hotUpdatePath,
   ];
 });
📜 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 2765cea and 622597f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • .changeset/violet-facts-notice.md (1 hunks)
  • CODEOWNERS (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/violet-facts-notice.md
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
🧠 Learnings (24)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • CODEOWNERS
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-09-25T14:03:25.576Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1834
File: packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createChunkLoading.ts:162-171
Timestamp: 2025-09-25T14:03:25.576Z
Learning: In the lynx-stack codebase, for loadScriptAsync implementations in createChunkLoading.ts, unhandled promise rejections from readScriptAsync are intentionally not caught - the caller is expected to handle errors rather than the loadScriptAsync method itself invoking the callback with error messages.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-27T11:36:36.415Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1589
File: packages/web-platform/web-tests/resources/web-core.main-thread.json:4-4
Timestamp: 2025-08-27T11:36:36.415Z
Learning: User PupilTong indicated that packages/web-platform/web-tests/resources/web-core.main-thread.json is considered a binary file, despite it appearing as a JSON text file with readable JavaScript code strings in the content.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
🧬 Code graph analysis (3)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (338-444)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (338-444)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)
packages/webpack/css-extract-webpack-plugin/test/helper/stubLynx.js (1)
  • createStubLynx (8-39)
⏰ 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 (25)
CODEOWNERS (1)

4-4: Verify the scope of code ownership changes.

The additions of @HuJean to packages/react/** and benchmark/react/** are syntactically correct. However, these changes appear orthogonal to the PR's primary objective of fixing CSS hot-update handling during chunk splitting.

Please confirm this ownership assignment is intentional and necessary for this PR, or clarify if it should be submitted as a separate change.

Also applies to: 6-6

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1)

1-107: Snapshot correctly documents per-entry CSS hot-update behavior for bundle-splitting case.

This snapshot file properly reflects the PR's fix for issue #1955 (lost styles during CSS chunk splitting HMR):

  • Per-entry manifests (Lines 10–12): Three separate .css.hot-update.json files are now generated for entries async/common, async/lazy, and entry, enabling granular CSS hot-update tracking.
  • Runtime hot-update list (Line 101): The __webpack_require__.cssHotUpdateList tracks per-entry hot-update paths, allowing the runtime to fetch and apply CSS updates for each entry independently during HMR.
  • Proper structure: The snapshot documents the expected output for webpack's hot-update process with bundle splitting enabled.

Note: Per learnings, snapshot files like this are auto-generated test outputs. If adjustments are needed to the snapshot content or structure, they should be made through the test code generator/plugin logic that produces them, not by manual editing of the snapshot itself.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css (1)

1-3: Red style fixture looks correct

.red { color: red; } is consistent with the test case name and is valid CSS; good as a minimal fixture.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css (1)

1-3: Blue style fixture looks correct

.blue { color: blue; } matches the fixture name and provides a clear second style for the code-splitting test.

.changeset/violet-facts-notice.md (1)

1-6: Changeset correctly documents the behavior change

The changeset targets the exact package names and succinctly describes the new behavior of merging CSS chunks and emitting a .css.hot-update.json per bundle. This fits the repo’s changeset conventions.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1)

1-39: Snapshot matches new per-entry CSS hot-update behavior

This new snapshot documents the expected assets and three per-bundle .css.hot-update.json manifests for the bundle-splitting case. Format and structure are consistent with existing hot-update-json snapshots and look like generated output rather than manual edits. Based on learnings, this is the right place to capture the raw compiler output.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1)

1-6: Test config is minimal and consistent

Typed config exporting bundlePath: ['entry.js'] matches the usual hotCases pattern and is sufficient to drive the new bundle-splitting snapshots.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1)

17-52: Chunk-splitting step‑0 snapshot updated for per-chunk CSS manifests

The asset list and four *.css.hot-update.json manifest sections now reflect per-chunk CSS hot-update output (index/main2/main3/main4). This matches the described “merge all css chunk and generate a .css.hot-update.json file for each bundle” behavior and is consistent with other snapshots’ structure.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (1)

17-309: Step‑2 snapshot correctly encodes LAST_HASH CSS manifests and runtime wiring

This snapshot now:

  • Lists index/main2/main3/main4.LAST_HASH.css.hot-update.json in the assets.
  • Adds corresponding JSON manifest sections for each entry.
  • Updates each *.LAST_HASH.hot-update.js runtime to set __webpack_require__.cssHotUpdateList to [[entryName, "<entryName>.LAST_HASH.css.hot-update.json"]].

That matches the new per-entry CSS HMR flow and LAST_HASH manifest naming, and the file looks like generated output consistent with other snapshots.

packages/webpack/template-webpack-plugin/package.json (1)

46-54: css-loader devDependency addition is verified as correct

The addition of "css-loader": "^7.1.2" is consistent with other webpack plugin packages in the workspace (react-webpack-plugin, css-extract-webpack-plugin, chunk-loading-webpack-plugin) and is fully compatible with the pinned webpack version ^5.102.0 (css-loader v7 requires webpack ^5.27.0+).

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1)

1-3: Lazy CSS fixture looks good

The .lazy rule is simple and valid, suitable as a hot-update test fixture.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js (1)

1-2: CSS imports correctly drive style-chunk test

Importing red.css before blue.css matches the test’s expected selector order.

packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1)

143-152: beforeEmit payload extension captured correctly in API report

Adding isAsync: boolean and entryNames: string[] to TemplateHooks.beforeEmit matches the described public API changes. Please just confirm this file was updated by re-running:

pnpm turbo api-extractor -- --local

and not edited manually.

As per coding guidelines, this file should always come from API Extractor output.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1)

1-7: Entry CSS fixture matches existing hot-update test patterns

Using --- as a separator and color: 'blue'; with quotes is consistent with other CSS fixtures that intentionally carry through “invalid” CSS for snapshot fidelity.

Based on learnings, this style is expected in these tests.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1)

1-3: Common helper is straightforward and correct

minus(a, b) is minimal and does what its name suggests.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1)

1-4: Lazy module wiring and helper look good

Importing ./lazy.css plus an add helper is a clean fixture for lazy chunk behavior.

packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)

126-127: LGTM! API extension aligns with per-entry hot-update requirements.

The addition of isAsync and entryNames to the beforeEmit hook payload is consistent with the PR's objective to support per-entry CSS hot-update handling. The fields are properly typed and documented as @alpha, and their usage at lines 895-896 confirms they're being populated correctly.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1)

1-56: LGTM! Test configuration properly exercises per-entry hot-update flow.

The configuration correctly sets up the bundle-splitting scenario with appropriate plugin ordering and filename patterns. The custom intermediate path at line 41 (.rspeedy/main) and CSS extraction patterns at lines 52-53 align with the per-entry hot-update requirements being tested.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (1)

1-274: LGTM! Snapshot reflects per-entry hot-update JSON generation.

The snapshot correctly captures the per-entry hot-update behavior with LAST_HASH naming across multiple entries (index, main2, main3, main4). The per-entry CSS hot-update JSON manifests at lines 36, 52, 68, and 84 demonstrate the expected per-entry handling introduced in this PR.

Based on learnings, snapshot files are auto-generated and should reflect the actual test output.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)

56-70: LGTM! Per-entry hot-update verification is comprehensive.

The test correctly verifies:

  • Per-entry hot-update JSON paths in cssHotUpdateList (lines 56-60)
  • File existence for all hot-update JSON files (lines 62-64)
  • Initial CSS content using base64 encoding matcher (lines 66-69)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js (1)

1-29: LGTM! Configuration properly tests code-splitting with CSS chunks.

The test configuration correctly sets up code-splitting with appropriate CSS extraction paths (lines 23-24) and async chunk filename pattern (line 19), which aligns with the PR's goal of testing per-entry hot-update handling.

packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (4)

128-128: LGTM! Per-entry hot-update tracking properly initialized.

The hotUpdateFiles map correctly tracks per-entry CSS hot-update file paths, enabling the per-entry hot-update flow that fixes the issue described in #1955.


171-242: LGTM! Per-entry hot-update emission properly implemented.

The loop correctly iterates over entryNames to generate per-entry hot-update JSON files. Key improvements:

  • Lines 178-180: Collects content from all CSS chunks (not just one)
  • Line 182: Passes array of CSS contents to convertCSSChunksToMap
  • Line 225: Emits hot-update JSON to per-entry path from hotUpdateFiles map

This addresses the bug where styles were lost during hot updates with chunk splitting.


249-260: LGTM! Runtime module extended to support per-entry hot-update.

The CSSHotUpdateRuntimeModule constructor properly accepts and stores the hotUpdateFiles map (lines 254-255, 259), enabling per-entry hot-update path resolution in the generated runtime code.


313-316: LGTM! Runtime module instantiation properly wired.

The runtime module is correctly instantiated with both this.hash and this.hotUpdateFiles (line 315), ensuring the generated runtime code has access to per-entry hot-update paths.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tract-webpack-plugin/src/CssExtractRspackPlugin.ts 92.59% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@HuJean HuJean changed the title refactor hot update of style fix: refactor hot update of style Nov 28, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Nov 28, 2025

CodSpeed Performance Report

Merging #1965 will degrade performances by 5.76%

Comparing p/hujing/hmr-css (9012a82) with main (6400f87)1

Summary

❌ 1 regression
✅ 62 untouched
⏩ 3 skipped2

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

Benchmarks breakdown

Benchmark BASE HEAD Change
transform 1000 view elements 44 ms 46.7 ms -5.76%

Footnotes

  1. No successful run was found on main (c16859d) during the generation of this report, so 6400f87 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 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.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Nov 28, 2025

Web Explorer

#6541 Bundle Size — 372.73KiB (0%).

9012a82(current) vs 6400f87 main#6520(baseline)

Bundle metrics  Change 1 change
                 Current
#6541
     Baseline
#6520
No change  Initial JS 146.31KiB 146.31KiB
No change  Initial CSS 32.4KiB 32.4KiB
Change  Cache Invalidation 0% 11.74%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 231(+0.43%) 230
No change  Duplicate Modules 16 16
No change  Duplicate Code 2.97% 2.97%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6541
     Baseline
#6520
No change  JS 243.35KiB 243.35KiB
No change  Other 96.98KiB 96.98KiB
No change  CSS 32.4KiB 32.4KiB

Bundle analysis reportBranch p/hujing/hmr-cssProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Nov 28, 2025

React Example

#6382 Bundle Size — 236.9KiB (0%).

9012a82(current) vs 6400f87 main#6360(baseline)

Bundle metrics  no changes
                 Current
#6382
     Baseline
#6360
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 162 162
No change  Duplicate Modules 65 65
No change  Duplicate Code 46.75% 46.75%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6382
     Baseline
#6360
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.14KiB 91.14KiB

Bundle analysis reportBranch p/hujing/hmr-cssProject dashboard


Generated by RelativeCIDocumentationReport issue

Comment thread packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts Outdated
Comment thread packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md Outdated
@HuJean HuJean force-pushed the p/hujing/hmr-css branch 2 times, most recently from cefde72 to fcbf45d Compare November 28, 2025 08:10
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: 2

♻️ Duplicate comments (3)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1)

16-56: Consider adding explicit chunk split configuration to match the reported issue.

The linked issue #1955 mentions the bug occurs with chunkSplit: { strategy: 'split-by-experience' }. This config relies solely on dynamic imports for code splitting rather than the explicit chunk split strategy mentioned in the reproduction steps.

While dynamic imports may still exercise the per-entry hot-update paths, consider adding a test case that mirrors the exact reproduction scenario to ensure full coverage.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js (1)

15-16: Fix the ineffective existsSync assertion.

The expect(existsSync(cssChunkPath)); call without a matcher doesn't assert anything and will pass regardless of whether the path exists.

Apply this diff:

   const cssChunkPath = join(__dirname, 'css');
-  expect(existsSync(cssChunkPath));
+  expect(existsSync(cssChunkPath)).toBe(true);
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)

47-55: Fix Promise constructor missing resolve and reject parameters.

The Promise constructor callback at line 48 is missing the resolve and reject parameters, but the inner done function references them at lines 51 and 53. This will cause a ReferenceError at runtime.

Apply this diff:

 it('should has cssHotUpdateList and hot-update.json', () => {
-  new Promise(()=>{
+  new Promise((resolve, reject) => {
     function done(error) {
       if (error) {
         reject(error)
       } else {
         resolve()
       }
     }
🧹 Nitpick comments (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

249-260: Using previous compilation hash for CSS hot-update filenames is correct; minor lifecycle considerations

Passing this.hash into CSSHotUpdateRuntimeModule and using it to build *.css.hot-update.json paths, while updating this.hash = compilation.hash only at the end of beforeEmit, gives the module access to the previous compilation hash and matches the expected LAST_HASH behavior in the snapshots. Storing the computed hotUpdatePath into the shared hotUpdateFiles map from generate() neatly bridges runtime and encode stages.

Two small points to keep in mind:

  • Because hotUpdateFiles is shared and never cleared, it relies on each compilation overwriting existing keys for active chunks; that’s fine given current usage, but worth remembering if you ever support dynamically removed entries.
  • Inside the map callback, you compute hotUpdatePath and then recompute an equivalent string for the returned pair; you could reuse hotUpdatePath for the return value for a tiny clarity win, but it’s not required.

Also applies to: 281-299, 315-316

📜 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 622597f and fcbf45d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • .changeset/violet-facts-notice.md (1 hunks)
  • CODEOWNERS (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/package.json (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • CODEOWNERS
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/snapshot/rspack/0.snap.txt
🚧 Files skipped from review as they are similar to previous changes (9)
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • .changeset/violet-facts-notice.md
🧰 Additional context used
🧠 Learnings (24)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-27T11:36:36.415Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1589
File: packages/web-platform/web-tests/resources/web-core.main-thread.json:4-4
Timestamp: 2025-08-27T11:36:36.415Z
Learning: User PupilTong indicated that packages/web-platform/web-tests/resources/web-core.main-thread.json is considered a binary file, despite it appearing as a JSON text file with readable JavaScript code strings in the content.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
📚 Learning: 2025-09-25T14:03:25.576Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1834
File: packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createChunkLoading.ts:162-171
Timestamp: 2025-09-25T14:03:25.576Z
Learning: In the lynx-stack codebase, for loadScriptAsync implementations in createChunkLoading.ts, unhandled promise rejections from readScriptAsync are intentionally not caught - the caller is expected to handle errors rather than the loadScriptAsync method itself invoking the callback with error messages.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.js
🧬 Code graph analysis (3)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)
packages/webpack/css-extract-webpack-plugin/test/helper/stubLynx.js (1)
  • createStubLynx (8-39)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
⏰ 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 (11)
packages/webpack/css-extract-webpack-plugin/package.json (1)

62-62: Peer dependency bump aligns with template plugin API change.

The version bump to ^0.10.0 corresponds to the new entryNames: string[] field added to TemplateHooks.beforeEmit. This is a breaking change for consumers who haven't upgraded the template plugin.

Ensure that a changeset has been added documenting this breaking peer dependency change so downstream consumers are aware they need to upgrade both packages together.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1)

98-103: Snapshot validates per-entry CSS hot-update tracking.

The cssHotUpdateList correctly maps each entry (lazy, common, entry) to its corresponding CSS hot-update JSON path. This per-entry approach directly addresses issue #1955 where styles were lost during HMR when CSS was split into chunks.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1)

1-6: LGTM!

The test configuration correctly specifies entry.js as the bundle path, matching the entry point defined in rspack.config.js.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.js (1)

1-2: LGTM!

Simple test fixture that imports multiple CSS files to exercise the style chunk merging behavior in code-splitting scenarios.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1)

1-3: LGTM!

Simple test fixture function that correctly serves its purpose for the bundle-splitting dynamic import test scenario.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1)

1-4: LGTM!

Correctly structured lazy-loaded module with CSS import for testing bundle-splitting hot-update behavior.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1)

1-7: LGTM!

Test fixture correctly uses the --- separator pattern for hot-update simulation. Based on learnings, the quoted 'blue' value is intentionally invalid CSS to test that snapshots correctly reflect source fixture contents.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1)

17-52: LGTM!

Auto-generated snapshot correctly reflects the per-entry CSS hot-update JSON manifests for the chunk-splitting scenario. The per-entry naming pattern (index.css.hot-update.json, main2.css.hot-update.json, etc.) aligns with the PR's refactored hot-update path handling.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (1)

17-36: LGTM!

Auto-generated snapshot correctly captures the per-entry CSS hot-update behavior after file changes. The LAST_HASH pattern and per-entry cssHotUpdateList mappings align with the refactored hot-update path handling.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (1)

17-24: Snapshot updates correctly reflect per-entry CSS hot-update manifests

The added *.LAST_HASH.css.hot-update.json manifest entries and their base64 payloads for index, main2, main3, and main4 align with the new per-entry CSS hot-update behavior and the existing cssHotUpdateList runtime output. Looks good and appropriate for an auto-generated snapshot.

Also applies to: 35-37, 49-54, 65-70, 81-86

packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

128-128: Per-entry CSS hot-update emission via hotUpdateFiles Map looks sound; confirm name alignment

The new hotUpdateFiles Map, populated by the runtime and consumed here in beforeEmit, gives you a clean per-entry path for emitting CSS hot-update JSON, and the args.entryNames loop properly skips entries without a recorded hot-update path. The array-based content passed into convertCSSChunksToMap also matches the updated template plugin API.

One subtle dependency is that entryName here must match the chunk.name used when populating hotUpdateFiles; otherwise get(entryName) would stay undefined and silently skip emission. Please double-check that the entry naming and chunk naming are guaranteed to be aligned in all supported configurations (including chunk-splitting strategies and non-default filenames).

Also applies to: 171-183, 225-225

@HuJean HuJean force-pushed the p/hujing/hmr-css branch 2 times, most recently from ac52a31 to 899d460 Compare December 1, 2025 05:18
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 (6)
.changeset/violet-facts-notice.md (1)

1-6: Improve the changeset description for end-users.

The changeset structure and package declarations are correct, but the description (Line 6) is implementation-focused and may not clearly communicate the value to end-users. The description explains what was changed (merge CSS chunks, generate .css.hot-update.json) but not why or what user-facing problem it solves.

Given that this PR fixes issue #1955 (lost styles during HMR when CSS is split into chunks), consider rewording the description to emphasize the user benefit:

-Merge all css chunk and generate a `.css.hot-update.json` file for each bundle.
+Fix lost styles during hot module replacement when CSS is split into chunks.

This makes the changeset more actionable for users reading release notes and aligns with the issue being addressed.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (2)

20-25: Simplify and clarify output.filename callback argument handling

Using (...args) and args[0].chunk.name is a bit opaque. Consider destructuring the pathData for readability and to avoid the magic index:

output: {
  filename: ({ chunk }) => {
    if (chunk && chunk.name === 'main') {
      return 'rspack.bundle.js';
    }
    return '[name].js';
  },
},

This keeps behavior the same while making the intent clearer.


47-50: Avoid re‑spreading LynxTemplatePlugin.defaultOptions when only overriding intermediate

Given LynxTemplatePlugin.apply already does Object.assign({}, LynxTemplatePlugin.defaultOptions, this.options), passing a spread of defaultOptions here is redundant. You can simplify to:

new LynxTemplatePlugin({
  intermediate: '.rspeedy/main',
}),

This is shorter and remains future‑proof if defaults change.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1)

1-25: Consider making CSS map assertions less index‑sensitive and aligning the test name

The test behavior looks correct, but two small robustness/readability nits you might consider (not blockers):

  • The checks on css.cssMap['0'][0] and [1] hard‑code both the bucket key and rule indices. If the CSS map ordering changes while still being semantically correct, this test will fail. You could instead derive the selectors from css.cssMap['0'] (e.g. map(r => r.selectorText.value)) and assert it equals or contains ['.red', '.blue'] in the expected relative order.
  • The description “should inline foo, but not inline bar” doesn’t match the actual assertions in this file (there’s no bar reference). If bar is exercised indirectly via other fixtures, you might still want to rename the test to describe what’s actually asserted here (e.g. around .red/.blue CSS in tasm.json) to reduce future confusion.
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (2)

161-245: beforeEmit per-entry loop looks correct; minor perf refactor is possible

The new logic:

  • Iterates over args.entryNames and, for each entry name that has a hotUpdateFilePath in hotUpdateFiles, encodes CSS and emits a corresponding *.css.hot-update.json.
  • Uses args.cssChunkscontent[]LynxTemplatePlugin.convertCSSChunksToMap, then derives cssDeps from css.cssMap and calls hooks.encode with the augmented encode options.

Functionally this matches the runtime side, where CSSHotUpdateRuntimeModule populates hotUpdateFiles keyed by chunk/entry name. The fact that hotUpdateFiles state is reused across compilations also aligns with prior learnings about not resetting compiler-scoped maps in watch mode. Based on learnings, this is a good approach.

One nit: if args.entryNames can contain multiple entries but args.cssChunks / finalEncodeOptions are identical for all of them, you’re recomputing css, cssDeps, and hooks.encode for each entry. If this scenario is common, consider computing css, cssDeps, and buffer once per beforeEmit call, then looping only to emit to each hotUpdateFilePath, e.g.:

const cssChunks = args.cssChunks;
const content = cssChunks.map(chunk =>
  chunk.source.source().toString('utf-8'),
);

const css = LynxTemplatePlugin.convertCSSChunksToMap(
  content,
  options.cssPlugins,
  Boolean(args.finalEncodeOptions.compilerOptions['enableCSSSelector']),
);

const cssDeps = /* as today */;

const {
  compilerOptions: { templateDebugUrl, ...restCompilerOptions },
} = args.finalEncodeOptions;

const { buffer } = await hooks.encode.promise({
  encodeOptions: {
    ...args.finalEncodeOptions,
    compilerOptions: restCompilerOptions,
    css,
    lepusCode: { root: undefined, lepusChunk: {} },
    manifest: {},
    customSections: {},
  },
});

const result = {
  content: buffer.toString('base64'),
  deps: cssDeps,
};

for (const entryName of args.entryNames) {
  const hotUpdateFilePath = this.hotUpdateFiles.get(entryName);
  if (!hotUpdateFilePath) continue;
  compilation.emitAsset(
    hotUpdateFilePath,
    new compiler.webpack.sources.RawSource(JSON.stringify(result), true),
  );
}

If entryNames is usually length 1, you can leave it as-is; this is just a potential micro-optimization.


249-305: Runtime module correctly produces per-chunk cssHotUpdateList and populates hotUpdateFiles

The updated CSSHotUpdateRuntimeModule:

  • Captures the previous compilation hash via the constructor argument and uses it to build *.css.hot-update.json names, which matches the “LAST_HASH” behavior in the snapshots.
  • Iterates over chunk.getAllAsyncChunks() plus the initial chunk to produce [chunkName, cssHotUpdatePath] pairs, then:
    • Computes a hotUpdatePath with the hash suffix and .css.hot-update.json.
    • Stores this in the shared hotUpdateFiles map keyed by chunkName.
    • Returns the same [chunkName, hotUpdatePath] pairs for cssHotUpdateList.

This ties together cleanly with the beforeEmit logic that later consumes hotUpdateFiles per entry. The design also leverages a shared map across all chunks/compilations rather than recomputing paths in the emit phase, which keeps the responsibilities nicely separated.

Minor readability nits (optional):

  • You compute hotUpdatePath but then recompute the same replacement in the return statement. You could reuse hotUpdatePath instead of repeating the replace call.
  • If you ever want to clarify the semantics, renaming hash/this.hash to something like lastCompilationHash would make it clearer why it differs from CURRENT_HASH in the runtime.

These are cosmetic; behavior-wise this looks solid.

📜 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 fcbf45d and ac52a31.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (32)
  • .changeset/violet-facts-notice.md (1 hunks)
  • CODEOWNERS (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/package.json (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/inline-scripts/inline-partial/rspack.config.js (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/webpack/template-webpack-plugin/test/cases/inline-scripts/inline-partial/rspack.config.js
✅ Files skipped from review due to trivial changes (3)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css
🚧 Files skipped from review as they are similar to previous changes (12)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • CODEOWNERS
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/snapshot/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/snapshot/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/package.json
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/violet-facts-notice.md
🧠 Learnings (25)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-25T14:03:25.576Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1834
File: packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createChunkLoading.ts:162-171
Timestamp: 2025-09-25T14:03:25.576Z
Learning: In the lynx-stack codebase, for loadScriptAsync implementations in createChunkLoading.ts, unhandled promise rejections from readScriptAsync are intentionally not caught - the caller is expected to handle errors rather than the loadScriptAsync method itself invoking the callback with error messages.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
📚 Learning: 2025-08-27T11:36:36.415Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1589
File: packages/web-platform/web-tests/resources/web-core.main-thread.json:4-4
Timestamp: 2025-08-27T11:36:36.415Z
Learning: User PupilTong indicated that packages/web-platform/web-tests/resources/web-core.main-thread.json is considered a binary file, despite it appearing as a JSON text file with readable JavaScript code strings in the content.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
🧬 Code graph analysis (5)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (2)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1)
  • foo (3-5)
packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (3)
  • tasmJSONPath (14-14)
  • content (15-15)
  • JSON (16-16)
packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (2)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
  • CssExtractRspackPlugin (122-122)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (3)
  • tasmJSONPath (18-18)
  • content (21-21)
  • JSON (22-22)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
🔇 Additional comments (17)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs (1)

1-6: LGTM! Test configuration structure is correct.

The test config properly specifies the main bundle entry point for the code-splitting test case. The JSDoc type annotation and CommonJS export structure align with the test framework expectations.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (3)

1-52: Config structure looks consistent with the intended CSS code‑splitting/HMR test

Imports, loader chain, splitChunks setup, and plugin wiring all look coherent for exercising CssExtractRspackPlugin + LynxTemplatePlugin behavior with code‑splitting; I don’t see blocking issues here.


28-31: Confirm that __main-thread naming matches the real chunk names

The chunks predicate excludes any chunk whose name contains '__main-thread'. Please double‑check that in the Rspack setup reproducing #1955, the affected chunks actually use this __main-thread suffix (and not e.g. :main-thread or another pattern), otherwise this test might not fully cover the original bug scenario.


32-38: Verify cacheGroups.foo.test matches the module path in the fixture

test: /foo\.js/ means only modules whose resource path contains foo.js will be grouped into the foo split chunk. Ensure the test fixture actually has such a module (e.g. an entry file named foo.js), or this cache group may end up empty and not create the intended extra JS/CSS chunk.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1)

1-5: Fixture module for code-splitting with CSS looks good

Top-level importing of ./red.css plus a simple foo() export is a clean, minimal fixture for the code-splitting test; no issues from my side.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css (1)

1-3: CSS fixture is minimal and correct

.red { color: red; } is valid and matches the selector asserted in the new test.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1)

1-107: Bundle-splitting HMR snapshot matches per-entry cssHotUpdateList design

The snapshot shows:

  • css hot-update manifests for lazy, common, and entry using *.LAST_HASH.css.hot-update.json.
  • entry.LAST_HASH.hot-update.js wiring __webpack_require__.cssHotUpdateList to [["lazy", ...], ["common", ...], ["entry", ...]].

This is consistent with the new hotUpdateFiles map and cssHotUpdateList generation in CssExtractRspackPlugin.ts. As long as this file was produced via the test runner’s snapshot update, it looks correct.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (1)

17-317: Chunk-splitting Step 2 snapshot reflects per-entry CSS hot-update wiring

The updated snapshot:

  • Introduces index/main2/main3/main4.LAST_HASH.css.hot-update.json manifests with consistent content structure.
  • Updates all corresponding *.LAST_HASH.hot-update.js files so each entry’s runtime sets cssHotUpdateList to a single [entryName, "<entry>.LAST_HASH.css.hot-update.json"] pair.

This aligns with the new per-entry cssHotUpdateList generation and hotUpdateFiles mapping added in the plugin code.

packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (2)

125-129: Persistent hotUpdateFiles map is appropriate for HMR

Keeping hotUpdateFiles as a long-lived Map<string, string> on the plugin implementation (instead of recreating it per compilation) is consistent with how HMR/watch-mode state typically needs to survive across compilations (similar to the cssModuleId2Deps pattern). Entries get overwritten per chunk name on each compilation, so you avoid stale data being read in later emits.


308-337: Runtime module installation for HMR is consistent with existing patterns

Using a WeakSet<Chunk> to ensure CSSHotUpdateRuntimeModule is only attached once per chunk, and wiring it into all the HMR-related runtimeRequirementInTree hooks (ensureChunkHandlers, hmrDownloadUpdateHandlers, hmrDownloadManifest, baseURI, externalInstallChunk, onChunksLoaded) follows the same pattern as other Lynx runtime modules.

Passing both this.hash and this.hotUpdateFiles into new CSSHotUpdateRuntimeModule(...) ensures the runtime has everything it needs without additional global state. No issues here.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (1)

17-274: Chunk-splitting Step 1 snapshot consistently reflects the new CSS HMR scheme

The snapshot updates:

  • Switch manifest names to *.LAST_HASH.css.hot-update.json for index/main2/main3/main4.
  • Show index/main2/main3/main4.LAST_HASH.hot-update.js runtimes assigning cssHotUpdateList to the appropriate [entryName, "<entry>.LAST_HASH.css.hot-update.json"] pairs.
  • Keep the webpack/runtime/get_full_hash block using CURRENT_HASH, which is expected.

This is in line with the new CSSHotUpdateRuntimeModule behavior and per-entry hotUpdateFiles mapping.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1)

1-2: Style entry fixture is appropriate for the test

Importing both ./red.css and ./blue.css in this entry is exactly what’s needed to exercise bundle-splitting of styles in the corresponding test.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1)

1-19: Test accurately validates merged CSS order for lazy bundle

This test:

  • Triggers creation of the lazy bundle by dynamically importing ./foo.js with webpackChunkName: 'test'.
  • Reads async/test/tasm.json and asserts that css.cssMap['0'] contains .red then .blue, which directly checks the regression described in the issue.

The assertions are a bit order-sensitive but appropriate for a focused regression test.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1)

1-3: Helper function is straightforward and correct

minus(a, b) simply returns a - b, which is correct for the test helper.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1)

1-4: LGTM!

This test fixture correctly sets up a lazy-loaded module that imports CSS and exports a simple function. The implementation is appropriate for testing CSS hot-update behavior with bundle splitting.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (2)

4-29: Configuration structure looks good.

The test configuration correctly sets up:

  • CSS extraction with appropriate loaders and filename patterns
  • Async chunk output paths that align with bundle-splitting scenarios
  • Plugin chain (CSS extraction, template, and encoding) that matches the test objectives

The configuration appropriately supports testing CSS hot-update behavior with chunk splitting.


2-2: Change import to use the local CssExtractRspackPlugin package.

This test should use the local css-extract-webpack-plugin to verify the hot-update tracking changes. Import from ../../../../src instead of @rspack/core.

import { CssExtractRspackPlugin } from '../../../../src';
⛔ Skipped due to learnings
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

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 (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

281-298: Duplicate path computation - reuse hotUpdatePath variable.

The hot-update path is computed on lines 285-288 and stored, but then the same replacement is recomputed in the return statement on lines 293-296. Use the already-computed hotUpdatePath variable instead.

             const cssHotUpdateList = [...asyncChunks, initialChunk].map((
               [chunkName, cssHotUpdatePath],
             ) => {
               // use hash of previous compilation cause CSSHotUpdateRuntimeModule can not get hash immediately
               const hotUpdatePath = cssHotUpdatePath!.replace(
                 '.css',
                 `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
               );
               // save all hot update file info
               this.hotUpdateFiles.set(chunkName!, hotUpdatePath);
-              return [
-                chunkName!,
-                cssHotUpdatePath!.replace(
-                  '.css',
-                  `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
-                ),
-              ];
+              return [chunkName!, hotUpdatePath];
             });
📜 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 ac52a31 and 899d460.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (32)
  • .changeset/violet-facts-notice.md (1 hunks)
  • CODEOWNERS (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/package.json (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/inline-scripts/inline-partial/rspack.config.js (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/webpack/template-webpack-plugin/test/cases/inline-scripts/inline-partial/rspack.config.js
✅ Files skipped from review due to trivial changes (1)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
🚧 Files skipped from review as they are similar to previous changes (16)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/snapshot/rspack/0.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • CODEOWNERS
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/snapshot/rspack/0.snap.txt
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/violet-facts-notice.md
🧠 Learnings (24)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
🧬 Code graph analysis (2)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1)
  • foo (3-5)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
🔇 Additional comments (19)
packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css (1)

1-3: CSS fixture is minimal and appropriate

.red { color: red; } is a clean, self-explanatory fixture for style/bundle-splitting tests; no issues from a test-data perspective.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1)

1-2: Side‑effect CSS imports look correct for the test

Using bare imports for ./red.css and ./blue.css matches how style-only entry fixtures are usually wired and allows order-sensitive assertions in bundle-splitting tests. No changes needed.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1)

1-6: LGTM! Test configuration follows established patterns.

The configuration correctly specifies the entry bundle for the bundle-splitting hot-update test case. The structure aligns with other test configs in the repository, and specifying only entry.js in bundlePath is appropriate—dynamically loaded bundles (common.js, lazy.js) will be loaded during test execution.

packages/webpack/css-extract-webpack-plugin/package.json (1)

62-62: Peer dependency version constraint references non-existent version.

The peer dependency constraint ^0.10.0 for @lynx-js/template-webpack-plugin cannot be satisfied. The package is currently at version 0.9.1 with no documented version bump to 0.10.0 in its CHANGELOG or changeset files. Update @lynx-js/template-webpack-plugin to version 0.10.0 and document the version change through the monorepo's release process.

⛔ Skipped due to learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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
Repo: lynx-family/lynx-stack PR: 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.
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2)

126-126: LGTM! Public API extension is properly typed.

The addition of entryNames to the beforeEmit hook payload enables per-entry context propagation, which aligns with the broader per-entry hot-update handling introduced in this PR.


894-894: LGTM! Implementation correctly passes entryNames.

The entryNames parameter is properly forwarded to the beforeEmit hook, completing the data flow for per-entry context propagation.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2)

68-70: LGTM! Test updated to reflect per-entry hot-update paths.

The test now correctly expects index.*.css.hot-update.json instead of lib-common.*, aligning with the per-entry hot-update path handling introduced in this PR.


86-88: LGTM! Second update block correctly uses per-entry paths.

Consistent with the first update block, this correctly expects per-entry hot-update paths.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1)

1-25: LGTM! Well-structured test for CSS code-splitting.

The test appropriately validates that CSS chunks are merged into the CSS map for the main bundle, with proper assertions on selector order.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1)

1-4: LGTM! Simple test fixture for bundle-splitting scenario.

The function correctly implements addition for testing purposes.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1)

1-3: LGTM! Simple test fixture for bundle-splitting scenario.

The function correctly implements subtraction for testing purposes.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (1)

1-274: LGTM! Auto-generated snapshot reflects per-entry hot-update changes.

The snapshot correctly captures the new per-entry hot-update behavior with LAST_HASH-based manifest naming and updated CSS hot-update JSON generation.

Based on learnings: snapshot files are auto-generated and reflect the source fixture behavior.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (1)

1-284: LGTM! Auto-generated snapshot captures step 2 of hot-update flow.

The snapshot correctly reflects the second update step with consistent LAST_HASH-based manifests and runtime updates.

Based on learnings: snapshot files are auto-generated test outputs.

.changeset/violet-facts-notice.md (1)

1-6: Ensure API extractor output is updated and committed.

The changeset package names are correct. For the public API changes in @lynx-js/template-webpack-plugin, run pnpm turbo api-extractor -- --local and commit the updated API report file at packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md.

⛔ Skipped due to learnings
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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.
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1)

1-107: Snapshot captures per-entry hot-update JSON paths correctly.

The snapshot properly reflects the new per-entry CSS hot-update behavior with separate manifests for async/common, async/lazy, and entry. The runtime cssHotUpdateList correctly maps each chunk to its corresponding hot-update JSON path. Based on learnings, this is an auto-generated file that reflects the source fixtures.

packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (4)

128-128: Approve per-entry hot-update tracking.

The new hotUpdateFiles map enables per-entry CSS hot-update path tracking, which is essential for fixing the style loss issue with chunk splitting (issue #1955).


171-180: Per-entry iteration with early skip is correct.

The logic correctly iterates over entryNames and skips entries that don't have a registered hot-update path. This ensures hot-update JSON files are only emitted for entries with corresponding CSS chunks.


249-260: Runtime module constructor correctly accepts and stores hotUpdateFiles.

The updated constructor signature properly receives the shared hotUpdateFiles map, enabling the runtime module's generate() method to populate it during the seal phase before the beforeEmit hook reads from it.


313-316: Runtime module instantiation correctly wired.

The handler correctly passes both this.hash and this.hotUpdateFiles to the runtime module, ensuring the per-entry hot-update paths are available during runtime code generation.

upupming
upupming previously approved these changes Dec 1, 2025
@HuJean HuJean force-pushed the p/hujing/hmr-css branch 2 times, most recently from dd623fe to 0001ee6 Compare December 1, 2025 06:49
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 (1)
examples/react/lynx.config.js (1)

27-27: Remove or uncomment the experimental line.

The commented pure_funcs configuration is redundant when drop_console: true is already set, as drop_console removes all console method calls.

-            // pure_funcs: ['console.info']
📜 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 899d460 and dd623fe.

📒 Files selected for processing (1)
  • examples/react/lynx.config.js (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/tools/Runtime/ListConsole.ts:48-60
Timestamp: 2025-11-06T01:17:14.493Z
Learning: In the Lynx runtime, console messages always include stack traces, so defensive null checks for `stackTrace.callFrames` in console message handling code are not required.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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:

  • examples/react/lynx.config.js
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • examples/react/lynx.config.js
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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:

  • examples/react/lynx.config.js
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.

Applied to files:

  • examples/react/lynx.config.js
🔇 Additional comments (1)
examples/react/lynx.config.js (1)

20-36: The review comment is factually incorrect. The file examples/react/lynx.config.js contains only 24 lines and does not include any of the minification configuration shown in the review (lines 20-36). The actual lines 20-24 contain only the environments configuration. The code snippet referenced in the review comment does not exist in the repository. The review cannot be addressed because it critiques code that was never committed.

Likely an incorrect or invalid review comment.

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

♻️ Duplicate comments (1)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)

47-81: Fix Promise handling and NEXT invocation to make the test actually wait for the HMR cycle.

Right now the async test body is broken in several ways:

  • The Promise executor doesn’t accept resolve / reject, but done closes over and calls them → ReferenceError when done() runs.
  • The Promise is never returned from the it callback, so the test framework won’t wait for the async work to finish.
  • NEXT is called with two arguments, but it expects only the callback returned by update(...); the extra vi.stubGlobal('lynx', lynx) is redundant (you already stubbed it at line 27) and changes the call signature.

A minimal fix that addresses all three issues:

-it('should has cssHotUpdateList and hot-update.json', () => {
-  new Promise(()=>{
-    function done(error) {
-      if (error) {
-        reject(error)
-      } else {
-        resolve()
-      }
-    }
+it('should has cssHotUpdateList and hot-update.json', () => {
+  return new Promise((resolve, reject) => {
+    function done(error) {
+      if (error) {
+        reject(error)
+      } else {
+        resolve()
+      }
+    }
@@
-    let prevHash = __webpack_hash__
-    NEXT(
-      vi.stubGlobal('lynx', lynx),
-      update(done, true, async () => {
-        const { content: entryContent } = __non_webpack_require__(`./entry.${prevHash}.css.hot-update.json`)
-        expect(entryContent).toBeBase64EncodedMatching('blue');
-        done();
-      })
-    )
+    let prevHash = __webpack_hash__
+    NEXT(
+      update(done, true, async () => {
+        const { content: entryContent } = __non_webpack_require__(`./entry.${prevHash}.css.hot-update.json`)
+        expect(entryContent).toBeBase64EncodedMatching('blue');
+        done();
+      })
+    )
   })
 })

This makes the test return a real Promise, wires done to that Promise, and restores the expected NEXT(update(...)) usage.

🧹 Nitpick comments (4)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (1)

60-71: index.*.css.hot-update.json naming looks consistent with per-entry HMR behavior

Both HMR steps now:

  • Build the JSON path as index.${prevHash}.css.hot-update.json under __dirname.
  • Load the same file via __non_webpack_require__(\./index.${prevHash}.css.hot-update.json`)`.

This keeps the filesystem check and the require in sync and matches a scenario where the entry name for this case is index. As long as the plugin emits per-entry CSS hot-update JSONs with this index.* prefix for this fixture, these expectations look correct and should guard against the regression in the linked issue.

If you expect the entry name to change again in future, you could optionally extract the 'index' prefix into a small helper/constant to avoid having to touch multiple literals next time, but that’s not required for correctness here.

Also applies to: 78-89

packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

285-298: Eliminate duplicate path computation.

The cssHotUpdatePath.replace() logic is computed twice identically. Reuse hotUpdatePath in the return array:

              const hotUpdatePath = cssHotUpdatePath!.replace(
                '.css',
                `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
              );
              // save all hot update file info
              this.hotUpdateFiles.set(chunkName!, hotUpdatePath);
              return [
                chunkName!,
-               cssHotUpdatePath!.replace(
-                 '.css',
-                 `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
-               ),
+               hotUpdatePath,
              ];
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1)

15-55: Align the JSDoc config type with Rspack instead of Webpack.

The config itself is using @rspack/core (default rspack import and DefinePlugin), but the JSDoc type at line 15 still references import('webpack').Configuration. For consistency with the other rspack.config.js in this PR and clearer editor tooling, consider updating it to:

-/** @type {import('webpack').Configuration} */
+/** @type {import('@rspack/core').Configuration} */

This keeps the type hint aligned with the actual bundler API you’re configuring.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (1)

19-26: Make the dynamic output.filename callback more robust and idiomatic.

The current implementation assumes args[0].chunk is always defined:

filename: (...args) => {
  if (args[0].chunk.name === 'main') {
    return 'rspack.bundle.js';
  }
  return '[name].js';
},

To guard against cases where chunk might be missing and to better reflect the documented signature (pathData, assetInfo), you can simplify and harden this to:

-    filename: (...args) => {
-      if (args[0].chunk.name === 'main') {
-        return 'rspack.bundle.js';
-      }
-      return '[name].js';
-    },
+    filename: (pathData) => {
+      if (pathData.chunk?.name === 'main') {
+        return 'rspack.bundle.js';
+      }
+      return '[name].js';
+    },

Same behavior in your test case but safer and easier to read.

📜 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 dd623fe and 0001ee6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (31)
  • .changeset/violet-facts-notice.md (1 hunks)
  • CODEOWNERS (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/package.json (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/snapshot/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
🧰 Additional context used
📓 Path-based instructions (2)
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/violet-facts-notice.md
🧠 Learnings (32)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • CODEOWNERS
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • .changeset/violet-facts-notice.md
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
📚 Learning: 2025-09-25T14:03:25.576Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1834
File: packages/web-platform/web-worker-runtime/src/backgroundThread/background-apis/createChunkLoading.ts:162-171
Timestamp: 2025-09-25T14:03:25.576Z
Learning: In the lynx-stack codebase, for loadScriptAsync implementations in createChunkLoading.ts, unhandled promise rejections from readScriptAsync are intentionally not caught - the caller is expected to handle errors rather than the loadScriptAsync method itself invoking the callback with error messages.

Applied to files:

  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
📚 Learning: 2025-08-27T11:36:36.415Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1589
File: packages/web-platform/web-tests/resources/web-core.main-thread.json:4-4
Timestamp: 2025-08-27T11:36:36.415Z
Learning: User PupilTong indicated that packages/web-platform/web-tests/resources/web-core.main-thread.json is considered a binary file, despite it appearing as a JSON text file with readable JavaScript code strings in the content.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-11T06:00:04.376Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:59-61
Timestamp: 2025-08-11T06:00:04.376Z
Learning: In the lynx-family/lynx-stack repository, the `testingLibraryPlugin` in `packages/react/testing-library/src/plugins/vitest.ts` intentionally uses `process.exit` when jsdom installation fails, maintaining consistency with the previous implementation from `packages/react/testing-library/src/vitest.config.js`. This behavior should not be changed to use `this.error` despite being a Vite plugin best practice.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • .changeset/violet-facts-notice.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/violet-facts-notice.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
🧬 Code graph analysis (3)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (3)
  • tasmJSONPath (18-18)
  • content (21-21)
  • JSON (22-22)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)
packages/webpack/css-extract-webpack-plugin/test/helper/stubLynx.js (1)
  • createStubLynx (8-39)
⏰ 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). (2)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (22)
CODEOWNERS (1)

4-4: LGTM! Ownership extension acknowledged.

Adding @HuJean as an additional owner for React-related packages is appropriate given their contribution to this PR.

Also applies to: 6-6

.changeset/violet-facts-notice.md (1)

1-6: LGTM! Changeset properly documents the feature.

The changeset correctly bumps both affected packages to minor versions and provides a clear description of the hot-update improvements.

packages/webpack/css-extract-webpack-plugin/package.json (1)

62-62: LGTM! Peer dependency update aligns with template plugin changes.

The bump to ^0.10.0 correctly reflects the dependency on new template plugin features (entryNames propagation) introduced in this PR.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1)

1-39: LGTM! Test snapshot validates bundle-splitting hot-update behavior.

This auto-generated snapshot correctly captures the initial state of per-entry CSS hot-update JSON files for the bundle-splitting scenario.

packages/webpack/template-webpack-plugin/package.json (1)

52-52: LGTM! css-loader added for test support.

Adding css-loader as a devDependency is appropriate for the new CSS extraction test cases introduced in this PR.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1)

1-6: LGTM! Test configuration properly specifies bundle entry.

The test config correctly identifies entry.js as the bundle path for the bundle-splitting hot-update test scenario.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1)

1-108: LGTM! Test snapshot validates hot-update runtime wiring.

This auto-generated snapshot correctly captures the hot-update state with LAST_HASH manifest naming and the cssHotUpdateList runtime mapping for all bundles (lazy, common, entry).

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (1)

1-316: LGTM! Test snapshot validates multi-entry chunk-splitting hot-update.

This auto-generated snapshot correctly captures the chunk-splitting scenario with multiple entries (index, main2, main3, main4), each with their own CSS hot-update list. This validates the PR's core objective of fixing lost styles during hot updates with chunk splitting.

packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

171-176: Verify execution order between runtime module generation and beforeEmit hook.

The beforeEmit hook reads from this.hotUpdateFiles which is populated by CSSHotUpdateRuntimeModule.generate(). The continue statement handles missing entries gracefully, but please confirm that generate() is always called before beforeEmit in webpack's lifecycle to ensure hot update files are emitted for all entries.

packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2)

119-127: Public API change: entryNames added to beforeEmit hook payload.

This is a backward-compatible addition that enables per-entry processing in downstream hooks. The hook payload interface is marked @alpha, so the change is acceptable.


886-895: LGTM!

Correctly propagates entryNames through the beforeEmit hook, enabling the CSS extract plugin to generate per-entry hot update files.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (1)

17-29: Snapshot correctly validates per-entry CSS hot update generation.

The snapshot demonstrates that each entry (index, main2, main3, main4) now receives its own .css.hot-update.json manifest, and the cssHotUpdateList runtime wiring correctly maps entries to their respective manifests. This aligns with the PR objective of fixing lost styles during HMR with chunk splitting.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1)

1-3: LGTM!

Clean test fixture for validating CSS hot updates in bundle-splitting scenarios. Uses valid CSS syntax.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1)

1-2: LGTM!

Simple test fixture that validates CSS imports are correctly handled in bundle-splitting scenarios.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1)

1-3: LGTM!

Simple test utility function for bundle-splitting hot-update tests.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1)

1-5: LGTM!

Test module correctly imports CSS and exports a simple function for code-splitting verification.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1)

1-4: LGTM!

Test module appropriately combines CSS import with a simple function for lazy bundle hot-update testing.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1)

11-19: LGTM!

Test correctly validates that CSS from a lazy-loaded bundle is merged into the cssMap. The path construction aligns with the webpackChunkName directive and expected bundle output location.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs (1)

1-6: LGTM!

Test configuration correctly specifies the bundle path for the test runner.

packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (1)

1-29: LGTM!

Rspack configuration correctly sets up CSS extraction, chunk splitting, and template plugin integration for the bundle-splitting test scenario. The output paths and plugin setup align with the PR objectives for per-entry CSS hot-update handling.

packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1)

15-25: LGTM! Test validates CSS merging for code-split main bundle.

The test correctly validates that CSS from both imported modules (red.css via foo.js and blue.css directly) are merged into the main bundle's cssMap. The assertions depend on the import order: foo.js (containing red.css) is imported first, followed by blue.css.

packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1)

150-150: Remove this review comment - entryNames is actively consumed.

The entryNames field is actively used in packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (line 171) to iterate over entries and generate per-entry CSS hot update files. This directly supports the PR's goal of preventing CSS loss during hot updates with chunked output.

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

♻️ Duplicate comments (1)
packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1)

47-81: Fix Promise usage and NEXT invocation in HMR test.

There are still a few correctness issues in this test:

  1. The Promise executor does not accept resolve/reject, but done calls them → ReferenceError at runtime.
  2. The Promise is created but not returned from the test callback, so the test runner may not wait for async completion.
  3. NEXT is invoked with an extra vi.stubGlobal('lynx', lynx) argument, even though lynx is already stubbed globally and NEXT expects only the callback from update().

You can fix all three with something like:

-it('should has cssHotUpdateList and hot-update.json', () => {
-  new Promise(()=>{
-    function done(error) {
-      if (error) {
-        reject(error)
-      } else {
-        resolve()
-      }
-    }
+it('should has cssHotUpdateList and hot-update.json', () => {
+  return new Promise((resolve, reject) => {
+    function done(error) {
+      if (error) {
+        reject(error)
+      } else {
+        resolve()
+      }
+    }
@@
-    let prevHash = __webpack_hash__
-    NEXT(
-      vi.stubGlobal('lynx', lynx),
-      update(done, true, async () => {
+    let prevHash = __webpack_hash__
+    NEXT(
+      update(done, true, async () => {
         const { content: entryContent } = __non_webpack_require__(`./entry.${prevHash}.css.hot-update.json`)
         expect(entryContent).toBeBase64EncodedMatching('blue');
         done();
       })
     )
   })
 })
🧹 Nitpick comments (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

125-317: HMR CSS hot-update wiring via hotUpdateFiles is sound; consider de-duplicating CSS parsing.

The new flow—runtime module computing per-entry .css.hot-update.json paths, storing them in hotUpdateFiles, and the beforeEmit hook emitting those JSON assets per entryName—correctly aligns runtime cssHotUpdateList with the generated manifests and should fix styles being lost when CSS is chunk-split.

Inside beforeEmit, the same args.cssChunks are parsed for every entryName. You could optionally move content/css/cssDeps computation outside the for ... of args.entryNames loop and reuse them per entry to avoid redundant work, especially when many entries share the same CSS.

Based on learnings, keeping hotUpdateFiles as a long-lived map across compilations is consistent with how other compiler-scoped maps (like cssModuleId2Deps) are managed for HMR.

📜 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 0001ee6 and 84f87c1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (31)
  • .changeset/violet-facts-notice.md (1 hunks)
  • CODEOWNERS (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/package.json (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (5 hunks)
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js (2 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js (1 hunks)
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (22)
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/snapshot/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/common.js
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.css
  • .changeset/violet-facts-notice.md
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.css
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/blue.css
  • CODEOWNERS
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/blue.css
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/red.css
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjs
🧰 Additional context used
🧠 Learnings (26)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-11T06:00:04.376Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:59-61
Timestamp: 2025-08-11T06:00:04.376Z
Learning: In the lynx-family/lynx-stack repository, the `testingLibraryPlugin` in `packages/react/testing-library/src/plugins/vitest.ts` intentionally uses `process.exit` when jsdom installation fails, maintaining consistency with the previous implementation from `packages/react/testing-library/src/vitest.config.js`. This behavior should not be changed to use `this.error` despite being a Vite plugin best practice.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
  • packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-11-04T10:15:14.965Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.965Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt
  • packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt
⏰ 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 (8)
packages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.js (2)

12-13: Verify that foo.js imports red.css for complete CSS merging test.

The test expects both .red and .blue selectors in the merged CSS map, but only blue.css is directly imported here. This is correct because foo.js imports red.css as a transitive dependency, and the test validates that the CSS chunk merging behavior correctly combines styles from both direct and indirect CSS imports into the main bundle's cssMap.


23-24: No issues found. The test correctly asserts deterministic CSS selector order based on webpack's chunk processing and the explicit splitChunks configuration. The foo chunk (containing .red from red.css) is processed before the main chunk (containing .blue from blue.css), making the order stable and reliable. The cssMap['0'] key represents the main entry chunk and is the correct target for assertions.

packages/webpack/css-extract-webpack-plugin/package.json (1)

61-63: Peer dependency bump matches new template plugin API.

Updating @lynx-js/template-webpack-plugin peer to ^0.10.0 is consistent with the new entryNames hook payload and ensures consumers don't pair this plugin with an incompatible older template plugin.

packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)

119-127: entryNames propagation into beforeEmit looks correct and consistent.

Adding entryNames: string[] to TemplateHooks.beforeEmit and wiring it through #encodeByAssetsInformation mirrors beforeEncode and enables per-entry consumers (like the CSS extractor) without breaking existing taps that ignore this field.

Also applies to: 805-895

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txt (1)

17-55: Chunk-splitting snapshot matches new per-entry CSS hot-update manifests.

The step-0 snapshot correctly reflects the move from a shared CSS manifest to four per-entry *.css.hot-update.json files with identical content, which aligns with the new cssHotUpdateList and emission logic.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt (1)

10-106: Bundle-splitting snapshot correctly reflects LAST_HASH CSS hot-update manifests.

The step-1 rspack snapshot shows per-bundle *.LAST_HASH.css.hot-update.json manifests and a runtime cssHotUpdateList pointing at those files, which matches the updated CSSHotUpdateRuntimeModule and hot-update emission logic.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txt (1)

17-277: Chunk-splitting step‑2 snapshot aligns with per-entry CSS LAST_HASH manifests.

The snapshot’s manifests and runtime cssHotUpdateList entries for index, main2, main3, and main4 match the new per-entry hot-update path generation and look internally consistent.

packages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txt (1)

17-178: Chunk-splitting step‑1 snapshot is consistent with new HMR manifest naming.

The index/main2/main3/main4.LAST_HASH.css.hot-update.json manifests and associated cssHotUpdateList runtime wiring look correct for the first HMR step under the new per-entry scheme.

upupming
upupming previously approved these changes Dec 1, 2025
@HuJean HuJean enabled auto-merge (squash) December 1, 2025 11:04
Comment thread packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts Outdated
Comment thread packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts Outdated
Comment thread .changeset/violet-facts-notice.md
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: 2

📜 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 84f87c1 and eabe913.

📒 Files selected for processing (1)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts

Comment thread packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts Outdated
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/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (2)

170-245: Avoid recomputing CSS parse/encode work per entryName in beforeEmit

Inside beforeEmit you:

  • Derive content from args.cssChunks once.
  • Then, for each entryName, you:
    • Look up hotUpdateFilePath from this.hotUpdateFiles.
    • Re-run LynxTemplatePlugin.convertCSSChunksToMap(...).
    • Rebuild cssDeps.
    • Call hooks.encode.promise(...) with the same encodeOptions (no dependence on entryName in this file).
    • Emit identical JSON content to different hotUpdateFilePaths.

Functionally this works, but it repeats the most expensive steps (CSS parse + encode) once per entry. Given current code, the encode result appears entry‑agnostic; you could:

  • Compute css, cssDeps, and the encoded buffer once (on first entryName that has a hotUpdateFilePath), cache { content, deps }, and
  • Reuse that cached result when emitting to each hotUpdateFilePath.

This would significantly reduce HMR overhead for multi‑entry builds while keeping behavior the same, as long as hooks.encode doesn’t implicitly depend on entryName (which it doesn’t in the arguments shown here). Please double‑check that assumption in the template plugin before refactoring.

Also, the emission silently skips entries when this.hotUpdateFiles lacks a key for some entryName. If entryName and the chunk names used in CSSHotUpdateRuntimeModule ever diverge, this will manifest as “missing CSS hot updates” with no diagnostics. Consider at least a debug‑level log or assertion when HMR is enabled and hotUpdateFilePath is unexpectedly missing to aid future debugging.


125-129: HMR hash and hotUpdateFiles lifetime are correct but subtle; consider clarifying

The combination of:

  • Plugin‑level hash and hotUpdateFiles (lines 125‑129),
  • Passing them into CSSHotUpdateRuntimeModule (line 312), and
  • Using this.hash when building *.css.hot-update.json paths (lines 284‑288) while updating this.hash = compilation.hash at the end of beforeEmit (line 243),

means:

  • On compilation N, runtime modules see hash from compilation N‑1, so the CSS hot‑update JSON filenames are based on the previous compilation hash.
  • This matches webpack’s convention where hotUpdateMainFilename’s [hash] corresponds to the last recorded hash, and the manifest content then carries the new hash. (docs.w3cub.com)
  • hotUpdateFiles is effectively a cross‑compilation cache keyed by chunk/entry name, updated in generate() and consumed in the next compilation’s beforeEmit, which aligns with the project’s prior pattern of keeping compiler‑scoped maps across watch recompilations. Based on learnings, this persistence approach is consistent with how other CSS dependency maps are handled.

The implementation looks sound, but the intent is easy to misread (e.g., someone might “simplify” it to use the current compilation hash and accidentally break HMR). Two small, optional polish ideas:

  • Rename hash to something like prevCompilationHash (and the plugin field likewise) or add a short comment near the constructor explaining it carries the previous compilation hash for HMR file naming.
  • Optionally clear this.hotUpdateFiles at the start of each new compilation if you ever expect entry/chunk names to be removed; stale keys are mostly harmless today, but an explicit reset would make the lifecycle more obvious without affecting the current behavior.

Also applies to: 249-295, 305-313

📜 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 eabe913 and 661cd7f.

📒 Files selected for processing (2)
  • .changeset/rotten-bikes-beg.md (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/rotten-bikes-beg.md
🧠 Learnings (16)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/rotten-bikes-beg.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/rotten-bikes-beg.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.

Applied to files:

  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rotten-bikes-beg.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • .changeset/rotten-bikes-beg.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • .changeset/rotten-bikes-beg.md
🧬 Code graph analysis (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (337-443)
⏰ 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). (4)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
  • GitHub Check: test-rust / clippy
🔇 Additional comments (1)
.changeset/rotten-bikes-beg.md (1)

1-5: Changeset content and semantics look correct

  • Correct scoped package name is used.
  • minor bump plus explicit **BREAKING CHANGE** note matches the repo’s 0.x convention for breaking changes while documenting the new @lynx-js/template-webpack-plugin requirement. Based on learnings, this aligns with existing changeset practices.

colinaaa
colinaaa previously approved these changes Dec 7, 2025
Co-authored-by: Qingyu Wang <40660121+colinaaa@users.noreply.github.com>
Signed-off-by: HuJean <7037477+HuJean@users.noreply.github.com>
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

♻️ Duplicate comments (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)

284-296: Use current compilation hash instead of previous compilation hash.

At line 288, the code uses this.hash (set from the previous compilation at line 244) to construct hot-update filenames. According to webpack's HMR protocol, hot-update files must use the current compilation hash to correctly match the runtime's expectations. The compilation object is accessible in the generate() method via closure (already used at lines 268 and 275), so compilation.hash should be used instead.

The comment at lines 285-286 incorrectly states that "CSSHotUpdateRuntimeModule can not get hash immediately"—the current compilation hash is available through compilation.hash when generate() executes. Using the previous hash causes hot-update files to reference an incorrect version identifier, which can break HMR update matching and cause style loss during hot-reload.

Apply this fix:

-            ) => {
-              // use hash of previous compilation cause CSSHotUpdateRuntimeModule can not get hash immediately
-              const hotUpdatePath = cssHotUpdatePath!.replace(
+            ) => {
+              const hotUpdatePath = cssHotUpdatePath!.replace(
                 '.css',
-                `${this.hash ? `.${this.hash}` : ''}.css.hot-update.json`,
+                `${compilation.hash ? `.${compilation.hash}` : ''}.css.hot-update.json`,
               );

Note: This issue was previously flagged and marked as addressed in commit 6aa7ae4, but the current code still uses this.hash. Please verify whether the fix was reverted or needs to be reapplied.

📜 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 6aa7ae4 and c60bec7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • packages/webpack/css-extract-webpack-plugin/package.json (1 hunks)
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (6 hunks)
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/webpack/template-webpack-plugin/package.json
  • packages/webpack/css-extract-webpack-plugin/package.json
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
🧠 Learnings (17)
📓 Common learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 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/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 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:

  • packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts
🧬 Code graph analysis (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (339-445)
🔇 Additional comments (3)
packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md (1)

136-152: API report change for beforeEmit looks consistent; ensure semver / extractor steps are covered

The addition of entryNames: string[]; to TemplateHooks.beforeEmit matches the implementation in LynxTemplatePlugin.ts and is a backward‑compatible extension of the payload. From this file’s side, the shape looks correct.

Please just double‑check that:

  • This file was regenerated via pnpm turbo api-extractor -- --local and not edited by hand.
  • The corresponding package has an appropriate (minor) version bump and changeset noting the new public hook field.

As per coding guidelines, API report files under packages/**/etc/*.api.md should always come from a fresh API extractor run.

packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2)

120-128: Extending TemplateHooks.beforeEmit with entryNames is coherent with existing hooks

Adding entryNames: string[] here aligns beforeEmit with beforeEncode, giving hook consumers consistent context for which entries a given template emission corresponds to. The type is clear and matches how entryNames is computed and forwarded elsewhere.

No functional issues spotted in this interface change.


884-905: Forwarding entryNames into beforeEmit hook is correctly wired

The beforeEmit.promise call now includes entryNames, sourced from the same array passed into #encodeByAssetsInformation (either the filtered entrypoints or [entryName] for async groups). This keeps the payload consistent with the updated type and mirrors how beforeEncode already exposes entryNames.

The rest of the payload is unchanged, so existing taps that ignore entryNames remain unaffected while new consumers can rely on it.

If there are external plugins tapping beforeEmit, it may be worth running a quick search to see whether any rely on an exact set of object keys (e.g., manual serialization) rather than treating the payload as an extensible bag of data, just to be safe.

@HuJean HuJean merged commit 8cdb69d into main Dec 8, 2025
82 of 85 checks passed
@HuJean HuJean deleted the p/hujing/hmr-css branch December 8, 2025 08:48
colinaaa pushed a commit that referenced this pull request Dec 14, 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/css-extract-webpack-plugin@0.7.0

### Minor Changes

- **BREAKING CHANGE**: Require `@lynx-js/template-webpack-plugin`
0.10.0. ([#1965](#1965))

- Merge all css chunk and generate a `.css.hot-update.json` file for
each bundle.
([#1965](#1965))

## @lynx-js/template-webpack-plugin@0.10.0

### Minor Changes

- Merge all css chunk and generate a `.css.hot-update.json` file for
each bundle.
([#1965](#1965))

## @lynx-js/react@0.115.1

### Patch Changes

- Auto define lynx.loadLazyBundle when using `import(/* relative path
*/)`. ([#1956](#1956))

- feat: support declaring cross-thread shared modules via Import
Attributes, enabling Main Thread Functions to call standard JS functions
directly. ([#1968](#1968))

- Usage: Add `with { runtime: "shared" }` to the `import` statement. For
example:

        ```ts
        import { func } from './utils.js' with { runtime: 'shared' };

        function worklet() {
          'main thread';
          func(); // callable inside a main thread function
        }
        ```

    -   Limitations:
- Only directly imported identifiers are treated as shared; assigning
the import to a new variable will result in the loss of this shared
capability.
- Functions defined within shared modules do not automatically become
Main Thread Functions. Accessing main-thread-only APIs (e.g.,
`MainThreadRef`) will cause errors.

## @lynx-js/rspeedy@0.12.2

### Patch Changes

- Bump Rsbuild v1.6.13 with Rspack v1.6.6.
([#1995](#1995))

-   Updated dependencies \[]:
    -   @lynx-js/web-rsbuild-server-middleware@0.19.1

## @lynx-js/react-rsbuild-plugin@0.12.1

### Patch Changes

- Avoid injecting hot update runtime when dev.hmr or dev.liveReload is
set to false.
([#1980](#1980))

- Updated dependencies
\[[`553ece1`](553ece1),
[`8cdb69d`](8cdb69d),
[`8cdb69d`](8cdb69d)]:
    -   @lynx-js/react-webpack-plugin@0.7.3
    -   @lynx-js/css-extract-webpack-plugin@0.7.0
    -   @lynx-js/template-webpack-plugin@0.10.0
    -   @lynx-js/react-alias-rsbuild-plugin@0.12.1
    -   @lynx-js/use-sync-external-store@1.5.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.4

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

### Patch Changes

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

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

### Patch Changes

- fix: support CSP for mts
([#1994](#1994))

- Updated dependencies
\[[`f7256d5`](f7256d5)]:
    -   @lynx-js/web-mainthread-apis@0.19.1
    -   @lynx-js/web-worker-runtime@0.19.1
    -   @lynx-js/web-constants@0.19.1
    -   @lynx-js/web-worker-rpc@0.19.1

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

### Patch Changes

- fix: fix reload lynx-view when `enableCSSSelector` false may cause css
style lost
([#1982](#1982))

-   Updated dependencies \[]:
    -   @lynx-js/web-constants@0.19.1

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

### Patch Changes

- Updated dependencies
\[[`f7256d5`](f7256d5)]:
    -   @lynx-js/web-mainthread-apis@0.19.1
    -   @lynx-js/web-constants@0.19.1
    -   @lynx-js/web-worker-rpc@0.19.1

## @lynx-js/react-webpack-plugin@0.7.3

### Patch Changes

- Support `@lynx-js/template-webpack-plugin` v0.10.0.
([#1992](#1992))

## create-rspeedy@0.12.2



## @lynx-js/react-alias-rsbuild-plugin@0.12.1



## upgrade-rspeedy@0.12.2



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



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



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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
f0rdream pushed a commit to f0rdream/lynx-stack that referenced this pull request Dec 18, 2025
Closed lynx-family#1955

<!--
  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**
* Per-bundle .css.hot-update.json files for live CSS hot-reloads and
improved CSS hot-update behavior.
* Better support for bundle-splitting and code-splitting: CSS chunks are
merged/mapped per entry for more accurate runtime styling.
* Template emission now receives per-entry name information, improving
generated outputs for multi-entry builds.

* **Tests**
* Added end-to-end test cases and snapshots covering hot-update and
bundle-splitting scenarios.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

## Checklist

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

- [ ] 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).
f0rdream pushed a commit to f0rdream/lynx-stack that referenced this pull request Dec 18, 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/css-extract-webpack-plugin@0.7.0

### Minor Changes

- **BREAKING CHANGE**: Require `@lynx-js/template-webpack-plugin`
0.10.0. ([lynx-family#1965](lynx-family#1965))

- Merge all css chunk and generate a `.css.hot-update.json` file for
each bundle.
([lynx-family#1965](lynx-family#1965))

## @lynx-js/template-webpack-plugin@0.10.0

### Minor Changes

- Merge all css chunk and generate a `.css.hot-update.json` file for
each bundle.
([lynx-family#1965](lynx-family#1965))

## @lynx-js/react@0.115.1

### Patch Changes

- Auto define lynx.loadLazyBundle when using `import(/* relative path
*/)`. ([lynx-family#1956](lynx-family#1956))

- feat: support declaring cross-thread shared modules via Import
Attributes, enabling Main Thread Functions to call standard JS functions
directly. ([lynx-family#1968](lynx-family#1968))

- Usage: Add `with { runtime: "shared" }` to the `import` statement. For
example:

        ```ts
        import { func } from './utils.js' with { runtime: 'shared' };

        function worklet() {
          'main thread';
          func(); // callable inside a main thread function
        }
        ```

    -   Limitations:
- Only directly imported identifiers are treated as shared; assigning
the import to a new variable will result in the loss of this shared
capability.
- Functions defined within shared modules do not automatically become
Main Thread Functions. Accessing main-thread-only APIs (e.g.,
`MainThreadRef`) will cause errors.

## @lynx-js/rspeedy@0.12.2

### Patch Changes

- Bump Rsbuild v1.6.13 with Rspack v1.6.6.
([lynx-family#1995](lynx-family#1995))

-   Updated dependencies \[]:
    -   @lynx-js/web-rsbuild-server-middleware@0.19.1

## @lynx-js/react-rsbuild-plugin@0.12.1

### Patch Changes

- Avoid injecting hot update runtime when dev.hmr or dev.liveReload is
set to false.
([lynx-family#1980](lynx-family#1980))

- Updated dependencies
\[[`553ece1`](lynx-family@553ece1),
[`8cdb69d`](lynx-family@8cdb69d),
[`8cdb69d`](lynx-family@8cdb69d)]:
    -   @lynx-js/react-webpack-plugin@0.7.3
    -   @lynx-js/css-extract-webpack-plugin@0.7.0
    -   @lynx-js/template-webpack-plugin@0.10.0
    -   @lynx-js/react-alias-rsbuild-plugin@0.12.1
    -   @lynx-js/use-sync-external-store@1.5.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.4

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

### Patch Changes

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

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

### Patch Changes

- fix: support CSP for mts
([lynx-family#1994](lynx-family#1994))

- Updated dependencies
\[[`f7256d5`](lynx-family@f7256d5)]:
    -   @lynx-js/web-mainthread-apis@0.19.1
    -   @lynx-js/web-worker-runtime@0.19.1
    -   @lynx-js/web-constants@0.19.1
    -   @lynx-js/web-worker-rpc@0.19.1

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

### Patch Changes

- fix: fix reload lynx-view when `enableCSSSelector` false may cause css
style lost
([lynx-family#1982](lynx-family#1982))

-   Updated dependencies \[]:
    -   @lynx-js/web-constants@0.19.1

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

### Patch Changes

- Updated dependencies
\[[`f7256d5`](lynx-family@f7256d5)]:
    -   @lynx-js/web-mainthread-apis@0.19.1
    -   @lynx-js/web-constants@0.19.1
    -   @lynx-js/web-worker-rpc@0.19.1

## @lynx-js/react-webpack-plugin@0.7.3

### Patch Changes

- Support `@lynx-js/template-webpack-plugin` v0.10.0.
([lynx-family#1992](lynx-family#1992))

## create-rspeedy@0.12.2



## @lynx-js/react-alias-rsbuild-plugin@0.12.1



## upgrade-rspeedy@0.12.2



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



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



## @lynx-js/web-worker-rpc@0.19.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

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Lost style in hot update when css is split to chunk

3 participants