Conversation
🦋 Changeset detectedLatest commit: 9012a82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
📝 WalkthroughWalkthroughAdds 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
d9951c7 to
622597f
Compare
There was a problem hiding this comment.
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 loggingThe switch to
index.${prevHash}.css.hot-update.jsonfor 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 filenamepackages/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
hotUpdatePathvariable 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.mdpackages/webpack/template-webpack-plugin/package.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tsCODEOWNERS
📚 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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/template-webpack-plugin/package.jsonpackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.mdpackages/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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/red.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/blue.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/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.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.jspackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.txtpackages/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.txtpackages/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/**andbenchmark/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.jsonfiles are now generated for entriesasync/common,async/lazy, andentry, enabling granular CSS hot-update tracking.- Runtime hot-update list (Line 101): The
__webpack_require__.cssHotUpdateListtracks 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 changeThe changeset targets the exact package names and succinctly describes the new behavior of merging CSS chunks and emitting a
.css.hot-update.jsonper 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 behaviorThis new snapshot documents the expected assets and three per-bundle
.css.hot-update.jsonmanifests 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 consistentTyped 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 manifestsThe asset list and four
*.css.hot-update.jsonmanifest 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 wiringThis snapshot now:
- Lists
index/main2/main3/main4.LAST_HASH.css.hot-update.jsonin the assets.- Adds corresponding JSON manifest sections for each entry.
- Updates each
*.LAST_HASH.hot-update.jsruntime to set__webpack_require__.cssHotUpdateListto[[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 correctThe 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 goodThe
.lazyrule 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 testImporting
red.cssbeforeblue.cssmatches 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 reportAdding
isAsync: booleanandentryNames: string[]toTemplateHooks.beforeEmitmatches the described public API changes. Please just confirm this file was updated by re-running:
pnpm turbo api-extractor -- --localand 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 patternsUsing
---as a separator andcolor: '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 goodImporting
./lazy.cssplus anaddhelper 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
isAsyncandentryNamesto thebeforeEmithook 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
hotUpdateFilesmap 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
entryNamesto 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
hotUpdateFilesmapThis 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
CSSHotUpdateRuntimeModuleconstructor properly accepts and stores thehotUpdateFilesmap (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.hashandthis.hotUpdateFiles(line 315), ensuring the generated runtime code has access to per-entry hot-update paths.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #1965 will degrade performances by 5.76%Comparing Summary
Benchmarks breakdown
Footnotes
|
Web Explorer#6541 Bundle Size — 372.73KiB (0%).9012a82(current) vs 6400f87 main#6520(baseline) Bundle metrics
Bundle size by type
|
| Current #6541 |
Baseline #6520 |
|
|---|---|---|
243.35KiB |
243.35KiB |
|
96.98KiB |
96.98KiB |
|
32.4KiB |
32.4KiB |
Bundle analysis report Branch p/hujing/hmr-css Project dashboard
Generated by RelativeCI Documentation Report issue
React Example#6382 Bundle Size — 236.9KiB (0%).9012a82(current) vs 6400f87 main#6360(baseline) Bundle metrics
|
| Current #6382 |
Baseline #6360 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
162 |
162 |
|
65 |
65 |
|
46.75% |
46.75% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #6382 |
Baseline #6360 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
91.14KiB |
91.14KiB |
Bundle analysis report Branch p/hujing/hmr-css Project dashboard
Generated by RelativeCI Documentation Report issue
cefde72 to
fcbf45d
Compare
There was a problem hiding this comment.
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 ineffectiveexistsSyncassertion.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 missingresolveandrejectparameters.The Promise constructor callback at line 48 is missing the
resolveandrejectparameters, but the innerdonefunction references them at lines 51 and 53. This will cause aReferenceErrorat 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 considerationsPassing
this.hashintoCSSHotUpdateRuntimeModuleand using it to build*.css.hot-update.jsonpaths, while updatingthis.hash = compilation.hashonly at the end ofbeforeEmit, gives the module access to the previous compilation hash and matches the expected LAST_HASH behavior in the snapshots. Storing the computedhotUpdatePathinto the sharedhotUpdateFilesmap fromgenerate()neatly bridges runtime and encode stages.Two small points to keep in mind:
- Because
hotUpdateFilesis 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
mapcallback, you computehotUpdatePathand then recompute an equivalent string for the returned pair; you could reusehotUpdatePathfor 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.jsonpackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/style-chunk/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/1.snap.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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.0corresponds to the newentryNames: string[]field added toTemplateHooks.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
cssHotUpdateListcorrectly 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.jsas the bundle path, matching the entry point defined inrspack.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_HASHpattern and per-entrycssHotUpdateListmappings 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 manifestsThe added
*.LAST_HASH.css.hot-update.jsonmanifest entries and their base64 payloads forindex,main2,main3, andmain4align with the new per-entry CSS hot-update behavior and the existingcssHotUpdateListruntime 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 viahotUpdateFilesMap looks sound; confirm name alignmentThe new
hotUpdateFilesMap, populated by the runtime and consumed here inbeforeEmit, gives you a clean per-entry path for emitting CSS hot-update JSON, and theargs.entryNamesloop properly skips entries without a recorded hot-update path. The array-basedcontentpassed intoconvertCSSChunksToMapalso matches the updated template plugin API.One subtle dependency is that
entryNamehere must match thechunk.nameused when populatinghotUpdateFiles; otherwiseget(entryName)would stayundefinedand 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
ac52a31 to
899d460
Compare
There was a problem hiding this comment.
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 clarifyoutput.filenamecallback argument handlingUsing
(...args)andargs[0].chunk.nameis 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‑spreadingLynxTemplatePlugin.defaultOptionswhen only overridingintermediateGiven
LynxTemplatePlugin.applyalready doesObject.assign({}, LynxTemplatePlugin.defaultOptions, this.options), passing a spread ofdefaultOptionshere 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 nameThe 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 fromcss.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
barreference). Ifbaris exercised indirectly via other fixtures, you might still want to rename the test to describe what’s actually asserted here (e.g. around.red/.blueCSS 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 possibleThe new logic:
- Iterates over
args.entryNamesand, for each entry name that has ahotUpdateFilePathinhotUpdateFiles, encodes CSS and emits a corresponding*.css.hot-update.json.- Uses
args.cssChunks→content[]→LynxTemplatePlugin.convertCSSChunksToMap, then derivescssDepsfromcss.cssMapand callshooks.encodewith the augmented encode options.Functionally this matches the runtime side, where
CSSHotUpdateRuntimeModulepopulateshotUpdateFileskeyed by chunk/entry name. The fact thathotUpdateFilesstate 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.entryNamescan contain multiple entries butargs.cssChunks/finalEncodeOptionsare identical for all of them, you’re recomputingcss,cssDeps, andhooks.encodefor each entry. If this scenario is common, consider computingcss,cssDeps, andbufferonce perbeforeEmitcall, then looping only to emit to eachhotUpdateFilePath, 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
entryNamesis 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 populateshotUpdateFilesThe updated
CSSHotUpdateRuntimeModule:
- Captures the previous compilation hash via the constructor argument and uses it to build
*.css.hot-update.jsonnames, 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
hotUpdatePathwith the hash suffix and.css.hot-update.json.- Stores this in the shared
hotUpdateFilesmap keyed bychunkName.- Returns the same
[chunkName, hotUpdatePath]pairs forcssHotUpdateList.This ties together cleanly with the
beforeEmitlogic that later consumeshotUpdateFilesper 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
hotUpdatePathbut then recompute the same replacement in thereturnstatement. You could reusehotUpdatePathinstead of repeating thereplacecall.- If you ever want to clarify the semantics, renaming
hash/this.hashto something likelastCompilationHashwould make it clearer why it differs fromCURRENT_HASHin the runtime.These are cosmetic; behavior-wise this looks solid.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/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.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js.changeset/violet-facts-notice.mdpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/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.csspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.js.changeset/violet-facts-notice.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/template-webpack-plugin/package.jsonpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/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.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/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.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt.changeset/violet-facts-notice.mdpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.mdpackages/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.jspackages/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.jspackages/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.mdpackages/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 testImports, 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-threadnaming matches the real chunk namesThe
chunkspredicate excludes any chunk whosenamecontains'__main-thread'. Please double‑check that in the Rspack setup reproducing #1955, the affected chunks actually use this__main-threadsuffix (and not e.g.:main-threador another pattern), otherwise this test might not fully cover the original bug scenario.
32-38: VerifycacheGroups.foo.testmatches the module path in the fixture
test: /foo\.js/means only modules whose resource path containsfoo.jswill be grouped into thefoosplit chunk. Ensure the test fixture actually has such a module (e.g. an entry file namedfoo.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 goodTop-level importing of
./red.cssplus a simplefoo()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 designThe snapshot shows:
- css hot-update manifests for
lazy,common, andentryusing*.LAST_HASH.css.hot-update.json.entry.LAST_HASH.hot-update.jswiring__webpack_require__.cssHotUpdateListto[["lazy", ...], ["common", ...], ["entry", ...]].This is consistent with the new
hotUpdateFilesmap andcssHotUpdateListgeneration inCssExtractRspackPlugin.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 wiringThe updated snapshot:
- Introduces
index/main2/main3/main4.LAST_HASH.css.hot-update.jsonmanifests with consistent content structure.- Updates all corresponding
*.LAST_HASH.hot-update.jsfiles so each entry’s runtime setscssHotUpdateListto a single[entryName, "<entry>.LAST_HASH.css.hot-update.json"]pair.This aligns with the new per-entry
cssHotUpdateListgeneration andhotUpdateFilesmapping added in the plugin code.packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (2)
125-129: PersistenthotUpdateFilesmap is appropriate for HMRKeeping
hotUpdateFilesas a long-livedMap<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 thecssModuleId2Depspattern). 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 patternsUsing a
WeakSet<Chunk>to ensureCSSHotUpdateRuntimeModuleis only attached once per chunk, and wiring it into all the HMR-relatedruntimeRequirementInTreehooks (ensureChunkHandlers,hmrDownloadUpdateHandlers,hmrDownloadManifest,baseURI,externalInstallChunk,onChunksLoaded) follows the same pattern as other Lynx runtime modules.Passing both
this.hashandthis.hotUpdateFilesintonew 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 schemeThe snapshot updates:
- Switch manifest names to
*.LAST_HASH.css.hot-update.jsonforindex/main2/main3/main4.- Show
index/main2/main3/main4.LAST_HASH.hot-update.jsruntimes assigningcssHotUpdateListto the appropriate[entryName, "<entry>.LAST_HASH.css.hot-update.json"]pairs.- Keep the
webpack/runtime/get_full_hashblock usingCURRENT_HASH, which is expected.This is in line with the new
CSSHotUpdateRuntimeModulebehavior and per-entryhotUpdateFilesmapping.packages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.js (1)
1-2: Style entry fixture is appropriate for the testImporting both
./red.cssand./blue.cssin 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 bundleThis test:
- Triggers creation of the lazy bundle by dynamically importing
./foo.jswithwebpackChunkName: 'test'.- Reads
async/test/tasm.jsonand asserts thatcss.cssMap['0']contains.redthen.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 returnsa - 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
../../../../srcinstead 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.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.ts (1)
281-298: Duplicate path computation - reusehotUpdatePathvariable.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
hotUpdatePathvariable 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjs.changeset/violet-facts-notice.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.cjspackages/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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/package.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/red.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.mdpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/package.jsonpackages/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.mdpackages/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.mdpackages/webpack/css-extract-webpack-plugin/package.jsonpackages/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.mdpackages/webpack/css-extract-webpack-plugin/package.jsonpackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/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 testUsing bare imports for
./red.cssand./blue.cssmatches 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.jsinbundlePathis 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.0for@lynx-js/template-webpack-plugincannot 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-pluginto 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
entryNamesto thebeforeEmithook 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
entryNamesparameter is properly forwarded to thebeforeEmithook, 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.jsoninstead oflib-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, runpnpm turbo api-extractor -- --localand commit the updated API report file atpackages/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, andentry. The runtimecssHotUpdateListcorrectly 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
hotUpdateFilesmap 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
entryNamesand 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
hotUpdateFilesmap, enabling the runtime module'sgenerate()method to populate it during the seal phase before thebeforeEmithook reads from it.
313-316: Runtime module instantiation correctly wired.The handler correctly passes both
this.hashandthis.hotUpdateFilesto the runtime module, ensuring the per-entry hot-update paths are available during runtime code generation.
dd623fe to
0001ee6
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
examples/react/lynx.config.js (1)
27-27: Remove or uncomment the experimental line.The commented
pure_funcsconfiguration is redundant whendrop_console: trueis already set, asdrop_consoleremoves all console method calls.- // pure_funcs: ['console.info']
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 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 fileexamples/react/lynx.config.jscontains 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.
There was a problem hiding this comment.
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 andNEXTinvocation to make the test actually wait for the HMR cycle.Right now the async test body is broken in several ways:
- The
Promiseexecutor doesn’t acceptresolve/reject, butdonecloses over and calls them →ReferenceErrorwhendone()runs.- The
Promiseis never returned from theitcallback, so the test framework won’t wait for the async work to finish.NEXTis called with two arguments, but it expects only the callback returned byupdate(...); the extravi.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, wiresdoneto thatPromise, and restores the expectedNEXT(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.jsonnaming looks consistent with per-entry HMR behaviorBoth HMR steps now:
- Build the JSON path as
index.${prevHash}.css.hot-update.jsonunder__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 thisindex.*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. ReusehotUpdatePathin 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(defaultrspackimport andDefinePlugin), but the JSDoc type at line 15 still referencesimport('webpack').Configuration. For consistency with the otherrspack.config.jsin 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 dynamicoutput.filenamecallback more robust and idiomatic.The current implementation assumes
args[0].chunkis always defined:filename: (...args) => { if (args[0].chunk.name === 'main') { return 'rspack.bundle.js'; } return '[name].js'; },To guard against cases where
chunkmight 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.js.changeset/violet-facts-notice.mdpackages/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.jsonCODEOWNERSpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.js.changeset/violet-facts-notice.mdpackages/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.jsonpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/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.jsonpackages/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.mdpackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/package.jsonpackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt.changeset/violet-facts-notice.mdpackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.csspackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt.changeset/violet-facts-notice.mdpackages/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.jsonpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/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.jsonpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/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.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/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.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/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.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.cjspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/test.config.cjspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txt.changeset/violet-facts-notice.mdpackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/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.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/lazy.csspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/index.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/rspack.config.jspackages/webpack/template-webpack-plugin/test/cases/bundle-splitting/with-style/foo.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.jspackages/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.txtpackages/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.0correctly 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.jsas 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
cssHotUpdateListruntime 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
beforeEmithook reads fromthis.hotUpdateFileswhich is populated byCSSHotUpdateRuntimeModule.generate(). Thecontinuestatement handles missing entries gracefully, but please confirm thatgenerate()is always called beforebeforeEmitin 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:entryNamesadded tobeforeEmithook 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
entryNamesthrough thebeforeEmithook, 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.jsonmanifest, and thecssHotUpdateListruntime 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 -entryNamesis actively consumed.The
entryNamesfield is actively used inpackages/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.
0001ee6 to
84f87c1
Compare
There was a problem hiding this comment.
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 andNEXTinvocation in HMR test.There are still a few correctness issues in this test:
- The Promise executor does not accept
resolve/reject, butdonecalls them →ReferenceErrorat runtime.- The Promise is created but not returned from the test callback, so the test runner may not wait for async completion.
NEXTis invoked with an extravi.stubGlobal('lynx', lynx)argument, even thoughlynxis already stubbed globally andNEXTexpects only the callback fromupdate().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 viahotUpdateFilesis sound; consider de-duplicating CSS parsing.The new flow—runtime module computing per-entry
.css.hot-update.jsonpaths, storing them inhotUpdateFiles, and thebeforeEmithook emitting those JSON assets perentryName—correctly aligns runtimecssHotUpdateListwith the generated manifests and should fix styles being lost when CSS is chunk-split.Inside
beforeEmit, the sameargs.cssChunksare parsed for everyentryName. You could optionally movecontent/css/cssDepscomputation outside thefor ... of args.entryNamesloop and reuse them per entry to avoid redundant work, especially when many entries share the same CSS.Based on learnings, keeping
hotUpdateFilesas a long-lived map across compilations is consistent with how other compiler-scoped maps (likecssModuleId2Deps) are managed for HMR.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.jsonpackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.jsonpackages/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.jsonpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/entry.jspackages/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.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/src/CssExtractRspackPlugin.tspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.jspackages/webpack/template-webpack-plugin/test/cases/code-splitting/with-style/index.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.jspackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/bundle-splitting/__snapshot__/rspack/1.snap.txtpackages/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.jspackages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.tspackages/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.jspackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/2.snap.txtpackages/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.txtpackages/webpack/css-extract-webpack-plugin/test/hotCases/hot-update-json/chunk-splitting/__snapshot__/rspack/0.snap.txtpackages/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 thatfoo.jsimportsred.cssfor complete CSS merging test.The test expects both
.redand.blueselectors in the merged CSS map, but onlyblue.cssis directly imported here. This is correct becausefoo.jsimportsred.cssas 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'scssMap.
23-24: No issues found. The test correctly asserts deterministic CSS selector order based on webpack's chunk processing and the explicit splitChunks configuration. Thefoochunk (containing.redfromred.css) is processed before the main chunk (containing.bluefromblue.css), making the order stable and reliable. ThecssMap['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-pluginpeer to^0.10.0is consistent with the newentryNameshook 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:entryNamespropagation intobeforeEmitlooks correct and consistent.Adding
entryNames: string[]toTemplateHooks.beforeEmitand wiring it through#encodeByAssetsInformationmirrorsbeforeEncodeand 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.jsonfiles with identical content, which aligns with the newcssHotUpdateListand 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 reflectsLAST_HASHCSS hot-update manifests.The step-1 rspack snapshot shows per-bundle
*.LAST_HASH.css.hot-update.jsonmanifests and a runtimecssHotUpdateListpointing at those files, which matches the updatedCSSHotUpdateRuntimeModuleand 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 CSSLAST_HASHmanifests.The snapshot’s manifests and runtime
cssHotUpdateListentries forindex,main2,main3, andmain4match 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.jsonmanifests and associatedcssHotUpdateListruntime wiring look correct for the first HMR step under the new per-entry scheme.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 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
eabe913 to
661cd7f
Compare
There was a problem hiding this comment.
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 perentryNameinbeforeEmitInside
beforeEmityou:
- Derive
contentfromargs.cssChunksonce.- Then, for each
entryName, you:
- Look up
hotUpdateFilePathfromthis.hotUpdateFiles.- Re-run
LynxTemplatePlugin.convertCSSChunksToMap(...).- Rebuild
cssDeps.- Call
hooks.encode.promise(...)with the sameencodeOptions(no dependence onentryNamein 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 encodedbufferonce (on firstentryNamethat has ahotUpdateFilePath), 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.encodedoesn’t implicitly depend onentryName(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.hotUpdateFileslacks a key for someentryName. IfentryNameand the chunk names used inCSSHotUpdateRuntimeModuleever 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 andhotUpdateFilePathis unexpectedly missing to aid future debugging.
125-129: HMR hash andhotUpdateFileslifetime are correct but subtle; consider clarifyingThe combination of:
- Plugin‑level
hashandhotUpdateFiles(lines 125‑129),- Passing them into
CSSHotUpdateRuntimeModule(line 312), and- Using
this.hashwhen building*.css.hot-update.jsonpaths (lines 284‑288) while updatingthis.hash = compilation.hashat the end ofbeforeEmit(line 243),means:
- On compilation N, runtime modules see
hashfrom 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)hotUpdateFilesis effectively a cross‑compilation cache keyed by chunk/entry name, updated ingenerate()and consumed in the next compilation’sbeforeEmit, 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
hashto something likeprevCompilationHash(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.hotUpdateFilesat 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
📒 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.
minorbump plus explicit**BREAKING CHANGE**note matches the repo’s 0.x convention for breaking changes while documenting the new@lynx-js/template-webpack-pluginrequirement. Based on learnings, this aligns with existing changeset practices.
Co-authored-by: Qingyu Wang <40660121+colinaaa@users.noreply.github.com> Signed-off-by: HuJean <7037477+HuJean@users.noreply.github.com>
661cd7f to
6aa7ae4
Compare
There was a problem hiding this comment.
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. Thecompilationobject is accessible in thegenerate()method via closure (already used at lines 268 and 275), socompilation.hashshould 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.hashwhengenerate()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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.tspackages/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.tspackages/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.tspackages/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.tspackages/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 forbeforeEmitlooks consistent; ensure semver / extractor steps are coveredThe addition of
entryNames: string[];toTemplateHooks.beforeEmitmatches the implementation inLynxTemplatePlugin.tsand 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 -- --localand 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.mdshould always come from a fresh API extractor run.packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (2)
120-128: ExtendingTemplateHooks.beforeEmitwithentryNamesis coherent with existing hooksAdding
entryNames: string[]here alignsbeforeEmitwithbeforeEncode, giving hook consumers consistent context for which entries a given template emission corresponds to. The type is clear and matches howentryNamesis computed and forwarded elsewhere.No functional issues spotted in this interface change.
884-905: ForwardingentryNamesintobeforeEmithook is correctly wiredThe
beforeEmit.promisecall now includesentryNames, 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 howbeforeEncodealready exposesentryNames.The rest of the payload is unchanged, so existing taps that ignore
entryNamesremain 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.
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>
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).
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>
Closed #1955
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist