feat(webpack-plugin): init externals-loading-webpack-plugin#1924
Conversation
📝 WalkthroughWalkthroughAdds a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1).changeset/*.md📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (9)📓 Common learnings📚 Learning: 2025-09-12T09:43:04.847ZApplied to files:
📚 Learning: 2025-09-12T09:43:04.847ZApplied to files:
📚 Learning: 2025-08-07T04:00:59.645ZApplied to files:
📚 Learning: 2025-07-22T09:23:07.797ZApplied to files:
📚 Learning: 2025-08-27T12:42:01.095ZApplied to files:
📚 Learning: 2025-07-22T09:26:16.722ZApplied to files:
📚 Learning: 2025-09-18T08:12:56.802ZApplied to files:
📚 Learning: 2025-08-21T08:46:54.494ZApplied to files:
🔇 Additional comments (2)
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 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (6)
packages/webpack/externals-loading-webpack-plugin/src/index.ts (3)
196-208: Document the deduplication behavior.The plugin deduplicates externals by
libraryName, keeping only the last definition when multiple externals share the same library name. This behavior might be unexpected and could lead to silent failures if users accidentally configure the same library twice with different URLs.Consider adding a warning log when duplicates are detected, or document this deduplication behavior in the interface JSDoc comments at lines 88-126.
327-331: Simplify layer determination logic.The nested ternary for layer determination is difficult to read and maintain.
Consider refactoring for clarity:
- const currentLayer = contextInfo?.issuerLayer === mainThreadLayer - ? 'mainThread' - : (contextInfo?.issuerLayer === backgroundLayer - ? 'background' - : undefined); + let currentLayer: 'mainThread' | 'background' | undefined; + if (contextInfo?.issuerLayer === mainThreadLayer) { + currentLayer = 'mainThread'; + } else if (contextInfo?.issuerLayer === backgroundLayer) { + currentLayer = 'background'; + }
232-244: Add performance warning to theasyncconfiguration option documentation.The code correctly implements both synchronous and asynchronous external loading paths as intentional features. However, the
asyncoption documentation (lines 102-106 inpackages/webpack/externals-loading-webpack-plugin/src/index.ts) should include a warning about performance implications when set tofalse.Currently, the interface documentation simply states: "Whether the source should be loaded asynchronously or not." with a default of
true. Consider enhancing it to note that synchronous loading withhandler.wait(timeout)blocks the JavaScript thread and can impact performance, recommending that async loading remain the default for most use cases./** * Whether the source should be loaded asynchronously or not. * * When set to `false`, uses synchronous loading via `handler.wait(timeout)`, * which blocks the JavaScript thread. This can significantly impact performance * and responsiveness. Synchronous loading should only be used when absolutely * necessary; async loading is recommended for most use cases. * * @defaultValue `true` */ async?: boolean;packages/webpack/externals-loading-webpack-plugin/README.md (1)
1-3: Consider expanding the README with usage examples.The README is quite minimal. For better developer experience, consider adding:
- Installation instructions
- Basic usage example
- Link to API documentation
- Requirements (Lynx version 3.4+)
- Configuration examples
However, the current content is acceptable for an initial release.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (1)
1-12: Test logic is identical to the sync case.The test code is identical to
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js. The behavioral difference is driven by the configuration (async vs sync externals loading). This is acceptable for test clarity, though the duplication could optionally be reduced by extracting a shared test helper.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (1)
20-22: Consider adding explanatory comments for test assertions.The assertions correctly verify that when an external is configured only for mainThread, the background bundle includes the module inline (contains
add(a, b)) while the mainThread bundle externalizes it (doesn't contain the code). This behavior could be non-obvious to future readers.Consider adding a comment:
+ // background bundle should contain inline module code since mock-module is not externalized in background context expect(background).toContain('add' + '(a, b)'); + // mainThread bundle should NOT contain inline module code since mock-module is externalized in mainThread context expect(mainThread).not.toContain('add' + '(a, b)');
📜 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)
packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/README.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/api-extractor.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/src/index.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/mock-module/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/vitest.config.ts(1 hunks)packages/webpack/tsconfig.json(1 hunks)
🧰 Additional context used
🧠 Learnings (26)
📓 Common learnings
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: 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: 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.
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: 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.
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: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/template-webpack-plugin/src/LynxCacheEventsSetupListRuntimeModule.ts:21-25
Timestamp: 2025-08-19T12:49:05.875Z
Learning: In the Lynx cache events system, there are two separate runtime modules with distinct responsibilities: `LynxCacheEventsSetupListRuntimeModule` is only responsible for initializing the setup list with the setup functions, while `LynxCacheEventsRuntimeModule` guarantees the initialization of `loaded` and `cachedActions` properties. The modules have a dependency relationship where `lynxCacheEventsSetupList` is required by `lynxCacheEvents`.
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: 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: 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.
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/vitest.config.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/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/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/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.jspackages/webpack/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/vitest.config.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/mock-module/package.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/webpack/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/tsconfig.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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/README.mdpackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/CHANGELOG.mdpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.jspackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
📚 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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/src/index.ts
📚 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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/src/index.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/externals-loading-webpack-plugin/api-extractor.json
📚 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/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.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:
packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.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/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/README.mdpackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/src/index.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/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/README.mdpackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/CHANGELOG.mdpackages/webpack/externals-loading-webpack-plugin/src/index.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/externals-loading-webpack-plugin/test/helpers/setup-env.js
📚 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/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/package.json
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js
📚 Learning: 2025-08-12T09:32:01.512Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/rspeedy/plugin-react/src/entry.ts:237-240
Timestamp: 2025-08-12T09:32:01.512Z
Learning: The events-cache.js functionality for caching events until background threads are ready is manually tested due to the complexity of constructing automated runtime test cases that involve timing, chunk loading, and browser runtime behavior.
Applied to files:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.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/externals-loading-webpack-plugin/README.mdpackages/webpack/externals-loading-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/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-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/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/vitest.config.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
📚 Learning: 2025-10-11T06:16:12.517Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1820
File: packages/web-platform/web-tests/tests/react.spec.ts:834-856
Timestamp: 2025-10-11T06:16:12.517Z
Learning: In packages/web-platform/web-tests/tests/react.spec.ts, the tests `basic-bindmouse` and `basic-mts-bindtouchstart` are NOT duplicates despite having similar test structures. They test different event types: `basic-bindmouse` validates mouse events (mousedown, mouseup, mousemove) with mouse-specific properties (button, buttons, x, y, pageX, pageY, clientX, clientY), while `basic-mts-bindtouchstart` validates touch events (touchstart) with touch arrays (touches, targetTouches, changedTouches). The similar test structure is coincidental and follows testing conventions.
Applied to files:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/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/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
🧬 Code graph analysis (15)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts (5)
packages/webpack/test-tools/src/case.ts (1)
describeCases(98-111)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (1)
path(7-7)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (1)
path(9-9)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
path(11-11)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (1)
path(11-11)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
ExternalsLoadingPlugin(146-352)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (2)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (1)
packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (1)
packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (4)
fs(6-6)path(7-7)background(9-12)mainThread(13-16)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (4)
fs(8-8)path(9-9)background(11-14)mainThread(15-18)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
packages/webpack/chunk-loading-webpack-plugin/test/cases/chunk-loading/runtime-globals/rspack.config.js (1)
compiler(20-20)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
⏰ 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 (29)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs (1)
1-7: Configuration is correct and follows established patterns.The bundlePath format
'main:main-thread.js'and'main:background.js'is consistent with all other test configurations in the plugin test suite. The test configuration is properly typed and structured.packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md (1)
1-5: LGTM!The changelog format and content are appropriate for an initial package release.
packages/webpack/externals-loading-webpack-plugin/test/mock-module/package.json (1)
1-4: LGTM!The mock module manifest is correctly structured for test fixtures with the private flag set appropriately.
packages/webpack/externals-loading-webpack-plugin/api-extractor.json (1)
1-6: LGTM!The API extractor configuration follows the established project pattern by extending the base configuration.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs (1)
1-7: LGTM!The test configuration is correctly structured with appropriate bundle paths for the sync externals loading test case.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js (1)
1-27: LGTM!The Rspack configuration is well-structured for the synchronous externals loading test case. The
async: falsesetting at line 16 is intentional and aligns with the test scenario.packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
23-127: Verify default timeout value for production usage.The default timeout is set to 100ms (line 122). For network-based external loading via
lynx.fetchBundle, this might be too short in production scenarios with poor network conditions or large bundles.Consider whether 100ms is sufficient for the expected use cases, or if a higher default (e.g., 5000ms) would be more appropriate. You may also want to document the timeout behavior more explicitly in the JSDoc comments.
packages/webpack/tsconfig.json (1)
17-17: LGTM!The TypeScript project reference is correctly added following the established pattern for other webpack plugins in this monorepo.
packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
4-6: LGTM!Clean test fixture implementation. The simple
addfunction is appropriate for validating externals loading behavior.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (1)
1-12: LGTM!The test correctly validates synchronous externals loading. The module-level execution pattern is appropriate for webpack plugin tests, where the code runs during bundle execution and the test verifies the outcome.
packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json (1)
1-10: LGTM!Standard TypeScript build configuration for a monorepo package. The composite project setup with separate src/lib directories is correct.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js (1)
1-27: LGTM!The configuration properly sets up the async externals loading test with background/main-thread layer separation. The use of the
createConfighelper keeps the setup clean and maintainable.packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts (1)
4-11: LGTM!Clean test suite setup using the standard
describeCasespattern. The default import fornode:pathfollows the codebase conventions.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (1)
1-28: LGTM!The test correctly verifies that the plugin doesn't override existing externals (lodash) while adding new ones (mock-module). The string concatenation pattern (
'module.exports ' + '= Lodash;') is a good defensive technique to prevent the test file itself from matching the search patterns.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
1-27: LGTM!The test effectively validates the background-only externals scenario by verifying that the
addfunction is not included in the background bundle but is present in the main-thread bundle. The string concatenation pattern maintains consistency with other tests to avoid false positives.packages/webpack/externals-loading-webpack-plugin/tsconfig.json (1)
1-8: LGTM!The TypeScript configuration is appropriate for this package, correctly including source, test directories, and the vitest config, with noEmit enabled for type-checking.
packages/webpack/externals-loading-webpack-plugin/package.json (1)
43-45: Verify the Node.js engine requirement.The package specifies
node: ">=18", which differs from the root project's requirement of^22 || ^24. While this may be intentional to support broader compatibility, please confirm:
- Whether this package truly needs to support Node.js 18-21
- If any features used require Node.js >=22 (as specified in the root)
- Whether this divergence is documented and justified
Based on learnings
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js (1)
1-24: LGTM!The test configuration correctly sets up the only-background-externals scenario using the shared createConfig helper with appropriate chunk, layer, and externals settings.
packages/webpack/externals-loading-webpack-plugin/vitest.config.ts (1)
1-11: LGTM!The Vitest configuration correctly defines the test project with an appropriate name and setup file path.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (1)
5-27: LGTM!The test correctly verifies deduplication of external loading code by checking that the pattern appears exactly once in each bundle. The string concatenation on lines 19 and 24 is intentional to avoid self-matching during webpack's code scanning.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs (1)
1-7: LGTM!The test configuration correctly specifies the bundle paths for the async externals-loading test case.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs (1)
1-7: LGTM!The test configuration correctly specifies the bundle paths for the not-overrides-existed-externals test case.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs (1)
1-7: LGTM!The test configuration correctly specifies the bundle paths for the only-background-externals test case, consistent with other test configurations in the suite.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
1-30: LGTM!The configuration correctly tests that the plugin's externals coexist with rspack's native externals configuration. The structure follows the established pattern from other test cases.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs (1)
1-7: LGTM!Standard test configuration following the established pattern for specifying which bundles the test should evaluate.
packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js (1)
1-35: LGTM!The test environment setup correctly mocks the Lynx runtime APIs (
fetchBundle,loadScript) required by the plugin. The dualwait()/then()pattern on the fetchBundle return value appropriately supports both synchronous and asynchronous external loading modes tested across the suite.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js (1)
1-23: LGTM!The configuration correctly defines the external only for the
mainThreadcontext, which meansmock-modulewill be externalized in mainThread bundles but bundled inline in background bundles. This properly exercises the layer-specific externals loading behavior.packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (2)
11-22: LGTM!Clean helper function that creates layer-based entry configurations. The default parameters and JSDoc annotations make it easy to use across test cases.
30-46: LGTM!Well-structured helper that composes test configurations with the plugin. The separation of plugin options and rspack externals parameters provides good flexibility for testing different scenarios.
CodSpeed Performance ReportMerging #1924 will not alter performanceComparing Summary
Footnotes
|
Web Explorer#6632 Bundle Size — 372.48KiB (0%).390d07a(current) vs 4e17b0b main#6616(baseline) Bundle metrics
|
| Current #6632 |
Baseline #6616 |
|
|---|---|---|
146.21KiB |
146.21KiB |
|
32.4KiB |
32.4KiB |
|
0% |
0% |
|
8 |
8 |
|
8 |
8 |
|
230 |
230 |
|
16 |
16 |
|
2.97% |
2.97% |
|
4 |
4 |
|
0 |
0 |
Bundle size by type no changes
| Current #6632 |
Baseline #6616 |
|
|---|---|---|
243.1KiB |
243.1KiB |
|
96.98KiB |
96.98KiB |
|
32.4KiB |
32.4KiB |
Bundle analysis report Branch luhc228:feat/init-externals-load... Project dashboard
Generated by RelativeCI Documentation Report issue
d9e7e94 to
2763df2
Compare
🦋 Changeset detectedLatest commit: 390d07a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
b69553a to
bb89724
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 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 (34)
.changeset/purple-friends-mate.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/README.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/api-extractor.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/src/index.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/mock-module/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/vitest.config.ts(1 hunks)packages/webpack/tsconfig.json(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md
- packages/webpack/externals-loading-webpack-plugin/test/mock-module/package.json
🚧 Files skipped from review as they are similar to previous changes (23)
- packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js
- packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md
- packages/webpack/externals-loading-webpack-plugin/tsconfig.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/package.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/api-extractor.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/README.md
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
- packages/webpack/externals-loading-webpack-plugin/vitest.config.ts
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json
- packages/webpack/externals-loading-webpack-plugin/src/index.ts
🧰 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/purple-friends-mate.md
🧠 Learnings (16)
📓 Common learnings
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: 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: 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: 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: 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.
📚 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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
📚 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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
📚 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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
📚 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/externals-loading-webpack-plugin/test/cases.test.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/externals-loading-webpack-plugin/test/cases.test.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.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/externals-loading-webpack-plugin/test/cases.test.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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/webpack/tsconfig.json
📚 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/purple-friends-mate.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/purple-friends-mate.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/purple-friends-mate.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/purple-friends-mate.md
🧬 Code graph analysis (6)
packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts (1)
packages/webpack/test-tools/src/case.ts (1)
describeCases(98-111)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (1)
packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (5)
consoleInfoMock(3-5)fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (4)
fs(6-6)path(7-7)background(9-12)mainThread(13-16)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (2)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)packages/webpack/externals-loading-webpack-plugin/test/mock-module/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
🪛 LanguageTool
.changeset/purple-friends-mate.md
[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---
(QB_NEW_DE)
🔇 Additional comments (8)
packages/webpack/tsconfig.json (1)
17-17: LGTM!The new project reference for
externals-loading-webpack-pluginfollows the existing naming conventions and placement patterns consistently. The addition is correctly positioned within the packages section and maintains proper formatting alignment with other entries.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (1)
1-12: LGTM!The test correctly sets up the console spy before invoking the function and verifies the expected behavior.
packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts (1)
1-11: LGTM!The test bootstrap follows the standard pattern and the copyright year has been correctly updated to 2025.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (1)
1-28: LGTM!The test correctly validates that both bundles contain the expected externals without overriding existing ones. The string concatenation pattern prevents false positives when searching the bundle code.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
1-27: LGTM!The test correctly validates that externals are loaded only in the background layer, with the main thread bundle containing the inline implementation.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (1)
1-26: LGTM!The test correctly validates that externals are loaded only in the main thread layer, with the background bundle containing the inline implementation. The logic correctly mirrors the opposite scenario of the only-background-externals test.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
1-30: LGTM!The configuration correctly defines layer-specific externals for the mock-module and includes lodash as an existing external to validate the non-override behavior.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs (1)
1-7: LGTM!The test configuration correctly specifies the bundle paths for validation. The structure follows the standard pattern used across the test suite.
bb89724 to
fd20b03
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/webpack/externals-loading-webpack-plugin/package.json (1)
1-46: Package manifest structure looks good.The package metadata, exports configuration, and build setup are properly structured. The local test dependency
"foo": "./test/foo"at line 41 is an acceptable pattern for test-only dependencies.Note: The missing peerDependencies for webpack/rspack has already been flagged in a previous review comment.
🧹 Nitpick comments (2)
packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js (1)
22-27: Mockthen()doesn't return a value.The
thencallback invokes the callback synchronously but doesn't return anything. If consumer code chains.then().then()or expects a return value, this mock would fail. For basic tests this works, but consider returning the callback result for more accurate Promise-like behavior.fetchBundle: (url) => { return { wait: () => ({ url, code: 0, err: null }), - then: (callback) => callback({ url, code: 0, err: null }), + then: (callback) => { + const result = callback({ url, code: 0, err: null }); + return Promise.resolve(result); + }, }; },packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
291-321: Consider adding timeout handling for async loading.The
createLoadExternalAsynchelper doesn't use thetimeoutoption, meaning async external loading could hang indefinitely if the fetch never resolves. While sync loading properly useshandler.wait(timeout), async relies solely on Promise resolution.If async timeout handling is desired, consider wrapping with
Promise.race:-function createLoadExternalAsync(handler, sectionPath) { +function createLoadExternalAsync(handler, sectionPath, timeout) { + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => reject(new Error('External loading timeout: ' + sectionPath)), timeout * 1000); + }); return new Promise((resolve, reject) => { - handler.then((response) => { + Promise.race([ + new Promise((res) => handler.then(res)), + timeoutPromise + ]).then((response) => { if (response.code === 0) { // ...existing code } - }) + }).catch(reject); }) }
📜 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 (35)
.changeset/chilly-ravens-smile.md(1 hunks).changeset/purple-friends-mate.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/README.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/api-extractor.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/src/index.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/foo/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/foo/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/vitest.config.ts(1 hunks)packages/webpack/tsconfig.json(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/webpack/externals-loading-webpack-plugin/test/foo/package.json
- packages/webpack/externals-loading-webpack-plugin/README.md
🚧 Files skipped from review as they are similar to previous changes (17)
- packages/webpack/externals-loading-webpack-plugin/api-extractor.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json
- packages/webpack/externals-loading-webpack-plugin/vitest.config.ts
- packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
- packages/webpack/tsconfig.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs
- .changeset/purple-friends-mate.md
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md
- packages/webpack/externals-loading-webpack-plugin/tsconfig.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js
🧰 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/chilly-ravens-smile.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/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md
🧠 Learnings (19)
📓 Common learnings
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: 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: 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: 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.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/template-webpack-plugin/src/LynxCacheEventsSetupListRuntimeModule.ts:21-25
Timestamp: 2025-08-19T12:49:05.875Z
Learning: In the Lynx cache events system, there are two separate runtime modules with distinct responsibilities: `LynxCacheEventsSetupListRuntimeModule` is only responsible for initializing the setup list with the setup functions, while `LynxCacheEventsRuntimeModule` guarantees the initialization of `loaded` and `cachedActions` properties. The modules have a dependency relationship where `lynxCacheEventsSetupList` is required by `lynxCacheEvents`.
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js.changeset/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.mdpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/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/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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.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/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.mdpackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.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/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.mdpackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.mdpackages/webpack/externals-loading-webpack-plugin/src/index.ts
📚 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:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.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/externals-loading-webpack-plugin/test/helpers/setup-env.jspackages/webpack/externals-loading-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 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/externals-loading-webpack-plugin/test/helpers/setup-env.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:
packages/webpack/externals-loading-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/externals-loading-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/externals-loading-webpack-plugin/package.json
🧬 Code graph analysis (5)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (5)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/foo/index.js (1)
add(4-6)packages/web-platform/web-tests/tests/coverage-fixture.ts (1)
expect(62-62)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (4)
fs(8-8)path(9-9)background(11-14)mainThread(15-18)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (2)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/foo/index.js (1)
add(4-6)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
🔇 Additional comments (19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs (1)
1-7: Config shape and export look goodType annotation plus
module.exportsstructure andbundlePathentries are consistent with existing case configs; nothing blocking here.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs (1)
1-7: Config shape and values look goodThe JSDoc typing and
module.exportsstructure match the expectedTConfigCaseConfigpattern, and thebundlePathentries for main-thread and background bundles look appropriate for this test case. No changes needed..changeset/chilly-ravens-smile.md (1)
1-28: LGTM! Changeset is well-documented.The changeset provides a clear description of the new ExternalsLoadingPlugin feature with a helpful usage example demonstrating the main configuration options.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js (1)
1-23: LGTM! Test configuration is properly structured.The test case configuration correctly uses the shared
createConfighelper and defines the external 'foo' with main-thread-only scope.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (1)
3-12: LGTM! Test logic is correct.The mock setup and assertions properly verify that the external module's
addfunction is called and returns the expected result.packages/webpack/externals-loading-webpack-plugin/test/foo/index.js (1)
1-6: LGTM! Test utility is simple and correct.The test helper module correctly exports a simple
addfunction used by multiple test cases.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (1)
1-12: LGTM! Test is well-structured.The async test case correctly imports from
'foo', sets up mocks, and verifies the expected behavior with proper assertions.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (1)
7-31: LGTM! Deduplication test is well-designed.The test correctly verifies that duplicate externals are filtered by reading the generated bundles and checking for exactly one occurrence of the external loading pattern in each. The string concatenation technique prevents build-time replacement of the search pattern.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (1)
7-28: LGTM! Test correctly verifies non-override behavior.The test validates that the plugin doesn't override existing externals (Lodash) while adding new ones (Foo). The string concatenation in assertions prevents build-time pattern replacement.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
1-30: LGTM!The test configuration correctly sets up a scenario for verifying that existing externals (like
lodash) are not overridden by the plugin. The configuration structure aligns withcreateConfighelper expectations, and theasync: falsesetting ensures the synchronous loading path is tested.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs (1)
1-7: LGTM!The test configuration correctly specifies the bundle paths for both main-thread and background chunks, enabling the test harness to validate the async externals loading behavior.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js (1)
1-27: LGTM!The test configuration correctly sets up an async external loading scenario with
async: true. The structure properly configures background and main-thread layers with their respective section paths.packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md (1)
1-41: API report looks complete.The generated API documentation correctly captures the public surface of
ExternalsLoadingPlugin, including the class, constructor,applymethod,RuntimeGlobals, and theExternalsLoadingPluginOptionsandLayerOptionsinterfaces. Ensure this file is kept in sync by runningpnpm turbo api-extractor -- --localafter any public API changes. As per coding guidelines.packages/webpack/externals-loading-webpack-plugin/src/index.ts (6)
1-19: LGTM!Clear license header and well-organized imports from
@rspack/core.
26-174: Comprehensive documentation.The
ExternalsLoadingPluginOptionsinterface is thoroughly documented with clear examples for different use cases (loading in both layers vs. single layer). ThelibraryNamedocumentation explaining deduplication behavior is particularly helpful.
222-227: LGTM!Static
RuntimeGlobalsprovides a clear, centralized reference for the webpack require extension.
272-283: Deduplication keeps last entry - verify this is intended.When multiple externals share the same
libraryName, the last entry wins. This is documented behavior, but ensure consumers understand that order matters when configuring externals with shared library names.
371-380: LGTM!The externals configuration correctly preserves existing externals (array or single value) while appending the generated config function.
399-435: LGTM!The externals resolver correctly handles layer detection and uses bracket notation with
JSON.stringifyto safely handle library names with special characters (addressing the previous review feedback).
fd20b03 to
23963a6
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
📜 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 (35)
.changeset/chilly-ravens-smile.md(1 hunks).changeset/purple-friends-mate.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/README.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/api-extractor.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/src/index.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/foo/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/foo/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/vitest.config.ts(1 hunks)packages/webpack/tsconfig.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/purple-friends-mate.md
🚧 Files skipped from review as they are similar to previous changes (24)
- packages/webpack/externals-loading-webpack-plugin/tsconfig.json
- packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js
- packages/webpack/externals-loading-webpack-plugin/test/foo/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts
- packages/webpack/externals-loading-webpack-plugin/test/foo/package.json
- packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md
- packages/webpack/externals-loading-webpack-plugin/vitest.config.ts
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/README.md
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
- packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js
🧰 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/chilly-ravens-smile.md
🧠 Learnings (21)
📓 Common learnings
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: 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: 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.
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js.changeset/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/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/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/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/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.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/externals-loading-webpack-plugin/api-extractor.json
📚 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/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/src/index.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/chilly-ravens-smile.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/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/src/index.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/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/externals-loading-webpack-plugin/test/helpers/create-config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/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/externals-loading-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/externals-loading-webpack-plugin/package.json
📚 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/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js
📚 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/externals-loading-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/externals-loading-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/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/src/index.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/externals-loading-webpack-plugin/package.jsonpackages/webpack/externals-loading-webpack-plugin/src/index.tspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.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/externals-loading-webpack-plugin/src/index.ts
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/webpack/tsconfig.json
📚 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:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js
🧬 Code graph analysis (4)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
ExternalsLoadingPlugin(230-444)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (4)
fs(8-8)path(9-9)background(11-14)mainThread(15-18)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
⏰ 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 / clippy
- GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (21)
packages/webpack/tsconfig.json (1)
17-17: Correctly adds TypeScript reference for the new package.The addition follows the established pattern and enables the externals-loading-webpack-plugin to be included in composite builds. Syntax and placement are correct.
packages/webpack/externals-loading-webpack-plugin/package.json (2)
41-41: Clarify the purpose and naming of the "foo" test dependency.Line 41 includes
"foo": "./test/foo"which appears to be a test mock module, but the generic placeholder name suggests this may be incomplete. Rename it to something descriptive (e.g.,"mock-module","test-helper") or document its purpose.
38-42: Missing peerDependencies for webpack in public plugin package.This public webpack plugin package lacks
peerDependenciesdeclarations. Without them, package managers won't warn users about incompatible bundler versions, leading to silent failures at runtime.Add peerDependencies and peerDependenciesMeta:
"devDependencies": { "@lynx-js/test-tools": "workspace:*", "@rspack/core": "catalog:rspack", "foo": "./test/foo" }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } + }, "engines": { "node": ">=18" }Adjust the webpack version range to match actual compatibility requirements.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (3)
1-5: LGTM!The imports and logging are appropriate for verifying that externals are loaded correctly.
7-18: LGTM!The test setup correctly reads the generated bundles for verification.
20-27: LGTM!The assertions correctly verify that both Lodash and Foo externals are present in the generated bundles for both layers.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (3)
1-7: LGTM!The mock setup correctly captures console.info calls for verification.
9-19: LGTM!The bundle reading logic is consistent with other test cases.
21-26: LGTM!The assertions correctly verify that when an external is configured only for the main-thread layer, the background bundle contains the inlined code while the main-thread bundle uses the external reference.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js (1)
1-24: LGTM!The configuration correctly sets up a background-only external for testing purposes.
packages/webpack/externals-loading-webpack-plugin/src/index.ts (8)
1-12: LGTM!The package documentation clearly states the Lynx version requirement (3.5+).
26-182: LGTM!The interface is well-documented with clear examples demonstrating single-layer and dual-layer external configurations.
184-236: LGTM!The class structure and example usage are clear and well-documented.
237-272: LGTM!The guard clauses properly handle edge cases and route to the appropriate layer code generation.
274-296: LGTM!The deduplication logic correctly handles scenarios where multiple external keys map to the same library, keeping the last definition.
297-329: LGTM!The runtime helper functions provide clear error messages and appropriate error handling for both async and sync loading paths.
331-376: LGTM!The code generation correctly uses bracket notation with JSON.stringify to safely handle library names, addressing the property injection concern from previous reviews.
404-443: LGTM!The externals configuration generator correctly determines the current layer and safely generates external references using bracket notation.
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (2)
1-22: LGTM!The
createEntrieshelper correctly generates dual-layer entry configurations for testing.
24-46: LGTM!The
createConfighelper provides a clean abstraction for test configurations with proper webpack experiments and plugin setup.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js (1)
1-26: LGTM!The synchronous loading test configuration correctly sets
async: falseand provides section paths for both layers.
React Example#6472 Bundle Size — 236.9KiB (0%).390d07a(current) vs 4e17b0b main#6456(baseline) Bundle metrics
|
| Current #6472 |
Baseline #6456 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
162 |
162 |
|
65 |
65 |
|
46.74% |
46.74% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #6472 |
Baseline #6456 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
91.14KiB |
91.14KiB |
Bundle analysis report Branch luhc228:feat/init-externals-load... Project dashboard
Generated by RelativeCI Documentation Report issue
23963a6 to
34688bd
Compare
34688bd to
35f58dd
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
3-7: Consider restoring theconsole.infospy after the case finishes
vi.spyOn(console, 'info').mockImplementation(...)at module scope will keepconsole.infostubbed until the environment or Vitest resets mocks. If other cases in the same runtime rely on the realconsole.info, they may inherit this stub. Consider adding something likeafterAll(() => consoleInfoMock.mockRestore());(or relying on a globalrestoreMocks: trueconfig) to make the lifecycle explicit.packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
1-46: Test helpers are straightforward and match current use cases.
createEntriesandcreateConfiggive a clear two-layer (main-thread/background) setup with layers enabled and the plugin wired in, which lines up with how all the case configs consume them. If we ever need cases with non-mainentry names or custom entry sources, we can extendcreateConfigto accept and forward those, but the current shape is sufficient for this plugin’s tests.packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
1-443: Consider explicitly propagatinglynx.fetchBundlerejections increateLoadExternalAsync.The generated
createLoadExternalAsynchelper wrapshandler(fromlynx.fetchBundle(...)) in a newPromiseand only attaches anonFulfilledhandler:function createLoadExternalAsync(handler, sectionPath) { return new Promise((resolve, reject) => { handler.then((response) => { // ... }) }) }If
lynx.fetchBundleis ever allowed to reject instead of resolving with a non‑zerocode, that rejection would neither callresolvenorreject, leaving the wrapper promise pending forever and surfacing only as an unhandled rejection on the originalhandler.If the engine’s contract guarantees that
fetchBundlenever rejects and always resolves with a{ code, url, ... }object (and your tests rely on that), this is fine but somewhat implicit. Otherwise, you may want to adjust the template to propagate rejections, for example:function createLoadExternalAsync(handler, sectionPath) { return handler.then((response) => { if (response.code === 0) { const result = lynx.loadScript(sectionPath, { bundleName: response.url }); return result; } throw new Error(/* ...same error message as today... */); }); }or by adding an explicit
onRejected/.catch(reject)branch inside the existing template. That keeps behavior clear without adding extra defensive checks elsewhere in the runtime module.
📜 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 (35)
.changeset/chilly-ravens-smile.md(1 hunks).changeset/purple-friends-mate.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/README.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/api-extractor.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/src/index.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/foo/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/foo/package.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/tsconfig.json(1 hunks)packages/webpack/externals-loading-webpack-plugin/vitest.config.ts(1 hunks)packages/webpack/tsconfig.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/webpack/externals-loading-webpack-plugin/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (22)
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js
- packages/webpack/externals-loading-webpack-plugin/CHANGELOG.md
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/foo/index.js
- packages/webpack/externals-loading-webpack-plugin/api-extractor.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/package.json
- .changeset/purple-friends-mate.md
- packages/webpack/externals-loading-webpack-plugin/test/foo/package.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/vitest.config.ts
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/test.config.cjs
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js
- packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js
- packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts
🧰 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/chilly-ravens-smile.md
🧠 Learnings (16)
📓 Common learnings
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: 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: 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.
📚 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/externals-loading-webpack-plugin/README.md.changeset/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/src/index.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:
packages/webpack/externals-loading-webpack-plugin/README.md.changeset/chilly-ravens-smile.md
📚 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/externals-loading-webpack-plugin/README.mdpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js.changeset/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.jspackages/webpack/externals-loading-webpack-plugin/src/index.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/externals-loading-webpack-plugin/README.md.changeset/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/src/index.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/externals-loading-webpack-plugin/test/helpers/create-config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/tsconfig.jsonpackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/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/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.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/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/src/index.ts
📚 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/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.jspackages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.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:
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/webpack/tsconfig.json
📚 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:
.changeset/chilly-ravens-smile.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/chilly-ravens-smile.mdpackages/webpack/externals-loading-webpack-plugin/src/index.ts
📚 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/externals-loading-webpack-plugin/src/index.ts
🧬 Code graph analysis (4)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (2)
packages/rspeedy/core/test/config/fixtures/custom/function.ts (1)
source(1-3)packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
ExternalsLoadingPlugin(230-444)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (3)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js (4)
fs(8-8)path(9-9)background(11-14)mainThread(15-18)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (4)
fs(10-10)path(11-11)background(13-16)mainThread(17-20)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (4)
fs(10-10)path(11-11)background(12-15)mainThread(16-19)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
packages/webpack/externals-loading-webpack-plugin/test/helpers/create-config.js (1)
createConfig(30-46)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (4)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-main-thread-externals/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/index.js (1)
consoleInfoMock(3-5)packages/webpack/externals-loading-webpack-plugin/test/foo/index.js (1)
add(4-6)
⏰ 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 (10)
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/sync/test.config.cjs (1)
1-7: Config shape and values look goodType annotation, CommonJS export, and
bundlePathentries align with the described test harness for main/background bundles. No changes needed.packages/webpack/externals-loading-webpack-plugin/README.md (1)
1-3: README provides appropriate introductory content for the new package.The minimal documentation is acceptable for the initial release. The heading and one-line description clearly identify the package and its purpose.
.changeset/chilly-ravens-smile.md (1)
1-28: Changeset follows proper format and documents the plugin introduction clearly.The entry includes correct frontmatter, a meaningful description, and a realistic usage example demonstrating the main plugin options and externals configuration. The API property naming (mainThread, background) is consistent and appropriate.
packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/only-background-externals/index.js (1)
9-27: Test structure and bundle assertions look solidAsserting on the compiled
main:background.jsvsmain:main-thread.jscontents plus the runtimeconsole.info(add(1, 2))call gives good coverage of the “only background externals” behavior: you verify both how the plugin rewrites bundles and that the external still evaluates correctly at runtime. Reading the bundles viafs.readFileSyncand matching theadd('a', 'b')snippet is consistent with how other webpack plugins in this repo assert on generated runtime artifacts rather than relying on dynamic execution timing, which fits externals wiring being decided at compile time. Based on learnings, this aligns well with existing webpack runtime module test patterns.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js (1)
1-28: Assertions correctly validate coexistence of regular externals and lynx_ex-based externals.This test exercises both background and main-thread bundles, confirming that the existing lodash external (
Lodash) is preserved while the plugin-providedFooexternal is exposed via__webpack_require__.lynx_ex["Foo"]. The dynamicnode:fs/node:pathusage is consistent with the other externals-loading case fixtures.packages/webpack/tsconfig.json (1)
17-17: New tsconfig reference for the plugin looks correct.Including
./externals-loading-webpack-plugin/tsconfig.build.jsonhere keeps the webpack composite project aware of the new plugin’s build, consistent with how other webpack plugins are wired.packages/webpack/externals-loading-webpack-plugin/tsconfig.build.json (1)
1-10: Build tsconfig matches expected per-package pattern.Extending the root config with
composite: true,rootDir: "./src",outDir: "./lib", and including onlysrcis a clean setup for emitting the plugin’s build artifacts.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/index.js (1)
1-12: Async externals test aligns with other cases and assertions are precise.Spying on
console.infoand invokingconsole.info(add(1, 2))at module evaluation time gives a simple, deterministic way to assert that the async external is wired and executed exactly once with value3, consistent with the other externals-loading case patterns.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/rspack.config.js (1)
1-30: Configuration cleanly models the “do not override existing externals” scenario.Using
createConfigfor the plugin options focused onfoowhile passing a separateexternalsmap (lodash: 'Lodash') correctly expresses that lodash should remain a regular external, which matches what the paired test asserts.packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/async/rspack.config.js (1)
1-27: Async rspack config is minimal and focused on the plugin behavior.This keeps the configuration scoped to the plugin-managed
fooexternal withasync: trueand symmetric background/mainThread layer/sectionPath wiring, which is ideal for the async test case.
* feat: add react externals example * feat: use globalThis & lynxCoreInject.tt to share between bundles * feat: simplify externals in defineExternalBundleRslibConfig
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (2)
examples/react-externals/lynx.config.js (2)
6-8: Make bundle-analysis env parsing explicit (optional).
!!process.env.RSPEEDY_BUNDLE_ANALYSISwill enable on"0". Consider checking=== '1'/=== 'true'if that matters.
19-82: Consider normalizingEXTERNAL_BUNDLE_PREFIXto avoid double slashes.Today
${EXTERNAL_BUNDLE_PREFIX}/react.lynx.bundlebecomes//react.lynx.bundleif the prefix already ends with/.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
examples/react-externals/src/assets/arrow.pngis excluded by!**/*.pngexamples/react-externals/src/assets/lynx-logo.pngis excluded by!**/*.pngexamples/react-externals/src/assets/react-logo.pngis excluded by!**/*.pngpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
examples/react-externals/README.md(1 hunks)examples/react-externals/external-bundle/CompLib.tsx(1 hunks)examples/react-externals/external-bundle/ReactLynx.ts(1 hunks)examples/react-externals/lynx.config.js(1 hunks)examples/react-externals/package.json(1 hunks)examples/react-externals/rslib-comp-lib.config.ts(1 hunks)examples/react-externals/rslib-reactlynx.config.ts(1 hunks)examples/react-externals/src/App.css(1 hunks)examples/react-externals/src/App.tsx(1 hunks)examples/react-externals/src/index.tsx(1 hunks)examples/react-externals/src/rspeedy-env.d.ts(1 hunks)examples/react-externals/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(2 hunks)packages/webpack/externals-loading-webpack-plugin/src/index.ts(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- examples/react-externals/src/App.css
- examples/react-externals/tsconfig.json
- examples/react-externals/src/rspeedy-env.d.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/webpack/externals-loading-webpack-plugin/src/index.ts
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
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: 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: 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.
📚 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-externals/src/App.tsxexamples/react-externals/lynx.config.jsexamples/react-externals/src/index.tsxexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.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:
examples/react-externals/src/App.tsxexamples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/src/index.tsxexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tsexamples/react-externals/README.md
📚 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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/README.md
📚 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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/src/index.tsxexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/README.md
📚 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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tsexamples/react-externals/README.md
📚 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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/src/index.tsxexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.md
📚 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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/src/index.tsxexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.md
📚 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:
examples/react-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.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, 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-externals/lynx.config.jsexamples/react-externals/package.jsonexamples/react-externals/README.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:
examples/react-externals/package.json
📚 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:
examples/react-externals/package.jsonexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.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:
examples/react-externals/package.json
📚 Learning: 2025-07-18T04:27:18.291Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.
Applied to files:
examples/react-externals/src/index.tsxexamples/react-externals/external-bundle/ReactLynx.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:
examples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.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:
examples/react-externals/rslib-reactlynx.config.tsexamples/react-externals/external-bundle/ReactLynx.tsexamples/react-externals/README.md
🧬 Code graph analysis (5)
examples/react-externals/src/App.tsx (3)
examples/react-externals/external-bundle/CompLib.tsx (1)
App(1-1)packages/react/transform/src/wasm.js (1)
view(24-28)packages/web-platform/web-tests/tests/react/basic-event-trigger/index.jsx (1)
text(6-6)
examples/react-externals/lynx.config.js (3)
packages/webpack/externals-loading-webpack-plugin/src/index.ts (1)
ExternalsLoadingPlugin(258-483)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
LAYERS(32-35)packages/rspeedy/plugin-qrcode/src/index.ts (1)
pluginQRCode(91-155)
examples/react-externals/rslib-comp-lib.config.ts (2)
packages/react/testing-library/src/vitest.config.js (1)
preactDir(37-41)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(187-210)LAYERS(32-35)
examples/react-externals/src/index.tsx (2)
examples/react-externals/external-bundle/CompLib.tsx (1)
App(1-1)examples/react-externals/src/App.tsx (1)
App(8-52)
examples/react-externals/rslib-reactlynx.config.ts (2)
packages/react/testing-library/src/vitest.config.js (1)
preactDir(37-41)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(187-210)LAYERS(32-35)
🪛 LanguageTool
examples/react-externals/README.md
[style] ~7-~7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...nt library to a separate Lynx bundle. - Use `@lynx-js/externals-loading-webpack-plu...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
⏰ 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)
examples/react-externals/src/index.tsx (3)
4-4: Keep./App.jsimport only if it’s required for externals matching.
lynx.config.jsexternalizes'./App.js', so changing this specifier can silently break externalization. If TS complains, fix via typings/config rather than changing the request string.
15-17: Verifyimport.meta.webpackHotis typed in this repo.Without a global augmentation for
ImportMeta, TS will fail typecheck here.
6-10: Avoid double-importingApp.css(it’s also imported inApp.tsx).Pick one import location to prevent duplicated style injection / ordering surprises.
⛔ Skipped due to 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: 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.examples/react-externals/rslib-reactlynx.config.ts (1)
49-54: Verifyreact→preactDiraliasing is sufficient for your imports.If any code resolves
react/jsx-runtime/react-dom-like entrypoints, aliasing to the package root may not behave likepreact/compat.examples/react-externals/src/App.tsx (1)
15-18: Clarify whether'background-only'is an intentional directive.If it’s not consumed by tooling as a directive-prologue marker, it’s dead code and should be removed.
examples/react-externals/lynx.config.js (1)
13-16: Verify chunk names match the actual emitted chunk names.If entry naming changes, externals loading will silently stop injecting runtime code (plugin gates by
this.chunk.name).packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
90-115: Externals transform looks coherent; verify the global roots are correct for both layers.Main-thread uses
globalThis.lynx_ex...; background useslynxCoreInject.tt.lynx_ex.... If either root can differ by runtime/SDK version, this will be a hard-to-debug runtime failure.examples/react-externals/rslib-comp-lib.config.ts (2)
1-16: Config setup looks consistent (and Node built-in import style matches repo convention).Based on learnings, default imports for Node built-ins are preferred in this repo.
57-80: Externals mapping matches newtransformExternalsexpectations.examples/react-externals/package.json (2)
2-5: Package manifest looks consistent for a private example app.
private: true,type: module, and workspace-managed Lynx deps make sense for an in-repo example.Also applies to: 13-26
8-10: Both rslib config files exist at the expected paths inexamples/react-externals/, so the build commands will not fail due to missing configuration.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
17-21: Resolveae-forgotten-exportforExternalBundleLibConfigby re-exporting it from the entryAPI Extractor is still warning that
ExternalBundleLibConfigis referenced in the public signature ofdefineExternalBundleRslibConfigbut not exported by the package entry (index.d.ts). This means consumers can’t name the type cleanly even though it’s part of the API surface.To fix this:
- Explicitly re-export
ExternalBundleLibConfig(and any other relevant helper types such asExternals/OutputConfigif desired) from your entry module, e.g.:// in packages/rspeedy/lynx-bundle-rslib-config/src/index.ts export type { ExternalBundleLibConfig } from './externalBundleRslibConfig.js';
- Then re-run
pnpm turbo api-extractor -- --localand commit the updated.api.mdso this warning disappears, per the repo’s API report guideline.After adding the re-export, please rerun API Extractor and verify that the
ae-forgotten-exportwarning is gone from this file.
🧹 Nitpick comments (4)
examples/react-externals/README.md (1)
5-7: Reduce repetition of "Use" at sentence start.Lines 5–7 each begin with "Use," creating repetitive structure. Consider rewording one or two bullets for better flow.
- Use `@lynx-js/lynx-bundle-rslib-config` to bundle ReactLynx runtime to a separate Lynx bundle. - Use `@lynx-js/lynx-bundle-rslib-config` to bundle a simple ReactLynx component library to a separate Lynx bundle. - Use `@lynx-js/externals-loading-webpack-plugin` to load ReactLynx runtime (sync) and component bundle (async). + Bundle ReactLynx runtime to a separate Lynx bundle using `@lynx-js/lynx-bundle-rslib-config`. + Bundle a simple ReactLynx component library to a separate Lynx bundle with `@lynx-js/lynx-bundle-rslib-config`. + Load ReactLynx runtime (sync) and component bundle (async) via `@lynx-js/externals-loading-webpack-plugin`.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)
78-89: New exported config types look structurally sound and align the public APIExporting
Externals,LibOutputConfig,OutputConfig, andExternalBundleLibConfighere makes thedefineExternalBundleRslibConfigsignature properly modelled and fixes the previous “internal-only type in public API” issue at the source-file level. TheExternalBundleLibConfigextension is backward-compatible (no new required fields) and keepsoutputoptional while enriching it withexternals.No change requested here; just make sure
ExternalBundleLibConfigis also re‑exported from the package entry (see API report comment) so consumers can reference it directly.If you want stronger discoverability, you could also explicitly re-export these types from the top-level
index.ts(even if you already wildcard-export this module) to make them more visible in editors and docs. Please double‑check how your current entry barrel is set up.
90-115: transformExternals logic is reasonable; consider clearer typing and “no externals” behaviorThe layer-aware mapping logic and callback usage look correct:
- Returns early when
requestis missing or unmapped.- Distinguishes
MAIN_THREADvs background viacontextInfo?.issuerLayerand builds the expected global path arrays.- Ensures
callbackis invoked at most once per call.Two small follow-ups you might consider:
Explicit typing for the externals function parameters – Right now
({ request, contextInfo }, callback)is untyped. Depending on your TS config, this may becomeany. Importing and using the appropriate Rspack/webpack externals function type (or at least a minimal structural type forcontextInfo/callback) would improve safety.Return value when
externalsis undefined –transformExternals(undefined)currently returns{}. If the underlyingexternalstype allowsundefined, returningundefinedinstead would preserve the “no externals configured” state and avoid forcing an empty externals object. IfRequired<LibOutputConfig>['externals']excludesundefined, you may want to widen the return type so you can distinguish those two cases.Please verify against
@rslib/core/ Rspack typings that (a) your externals function shape matches whatLibOutputConfig['externals']expects, and (b) whetherundefinedis a legal value there; if so, adjusting the return type to includeundefinedwould be cleaner.
188-188: Config merge correctly injects transformed externals; watch the “always set externals” behaviorWiring
ExternalBundleLibConfigintodefineExternalBundleRslibConfigand feedinguserLibConfig.output?.externalsthroughtransformExternalsbefore merging viarsbuild.mergeRsbuildConfigis a good shape and keeps the higher-level API focused on a simpleRecordof externals.One subtle semantic change: even when the user doesn’t provide
output?.externals, this block will setexternalsto{}(viatransformExternals(undefined)). That’s probably harmless and matches your intention (“no externals”), but it does mean we no longer distinguish between “no externals key at all” and “explicit empty externals object”.If you care about that distinction, you could special-case
undefined:const userExternals = userLibConfig.output?.externals; output: { ...userLibConfig.output, ...(userExternals !== undefined && { externals: transformExternals(userExternals), }), }Otherwise, the merge structure looks fine and should preserve defaults from
defaultExternalBundleLibConfigwhile layering user config + transformed externals on top.Please confirm that
rsbuild.mergeRsbuildConfigindeed deep-mergesoutputobjects as expected so that overriding it here with a partial (plusexternals) doesn’t drop any defaults you rely on.Also applies to: 196-202
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
examples/react-externals/README.md(1 hunks)examples/react-externals/package.json(1 hunks)examples/react-externals/rslib-reactlynx.config.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(2 hunks)packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js(1 hunks)packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
- packages/webpack/externals-loading-webpack-plugin/etc/externals-loading-webpack-plugin.api.md
- packages/webpack/externals-loading-webpack-plugin/test/helpers/setup-env.js
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/not-overrides-existed-externals/index.js
- examples/react-externals/rslib-reactlynx.config.ts
- examples/react-externals/package.json
- packages/webpack/externals-loading-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/index.js
🧰 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/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (10)
📓 Common learnings
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: 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: 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: 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.
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: 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.
📚 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/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tsexamples/react-externals/README.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:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tsexamples/react-externals/README.md
📚 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/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.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:
examples/react-externals/README.md
📚 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:
examples/react-externals/README.md
📚 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-externals/README.md
📚 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:
examples/react-externals/README.md
📚 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:
examples/react-externals/README.md
📚 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:
examples/react-externals/README.md
🪛 LanguageTool
examples/react-externals/README.md
[style] ~7-~7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...nt library to a separate Lynx bundle. - Use `@lynx-js/externals-loading-webpack-plu...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
⏰ 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)
examples/react-externals/README.md (1)
11-16: Great job fixing the URL syntax.The
EXTERNAL_BUNDLE_PREFIXexample has been corrected to use valid host:port syntax (http://${YOUR_IP_HERE}:8080). Well done resolving the prior review feedback.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
examples/react-externals/rslib-reactlynx.config.ts (1)
20-31: Consider consistent property ordering across rules.The first rule has
test → issuerLayer → loaderwhile the second hasissuerLayer → test → loader. Aligning the property order improves readability.{ - issuerLayer: LAYERS.MAIN_THREAD, test: /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, + issuerLayer: LAYERS.MAIN_THREAD, loader: ReactWebpackPlugin.loaders.MAIN_THREAD, },
📜 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 (3)
examples/react-externals/package.json(1 hunks)examples/react-externals/rslib-comp-lib.config.ts(1 hunks)examples/react-externals/rslib-reactlynx.config.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- examples/react-externals/package.json
🧰 Additional context used
🧠 Learnings (19)
📓 Common learnings
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: 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: 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.
📚 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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.ts
📚 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-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-reactlynx.config.ts
📚 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:
examples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-reactlynx.config.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
examples/react-externals/rslib-reactlynx.config.ts
📚 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:
examples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-reactlynx.config.ts
📚 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:
examples/react-externals/rslib-reactlynx.config.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:
examples/react-externals/rslib-reactlynx.config.ts
🧬 Code graph analysis (2)
examples/react-externals/rslib-comp-lib.config.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(187-210)LAYERS(32-35)packages/rspeedy/plugin-react-alias/src/index.ts (1)
pluginReactAlias(23-214)
examples/react-externals/rslib-reactlynx.config.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(187-210)LAYERS(32-35)packages/rspeedy/plugin-react-alias/src/index.ts (1)
pluginReactAlias(23-214)
⏰ 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 (7)
examples/react-externals/rslib-reactlynx.config.ts (3)
1-14: LGTM on imports and module resolution setup.The imports follow the codebase convention of using default imports for Node.js built-in modules. The
createRequirepattern for resolving the@lynx-js/reactpackage directory is idiomatic for ESM.
35-47: LGTM on source configuration.The entry point and define constants are properly configured. The string-wrapped boolean values (
'false') are correct for the DefinePlugin pattern.
48-57: LGTM on plugins and output configuration.The
pluginReactAliasusage correctly passesLAYERSandrootPathmatching its expected signature. DisablingcleanDistPathandminifyis reasonable for external bundle builds.examples/react-externals/rslib-comp-lib.config.ts (4)
1-9: LGTM!Imports follow codebase conventions: default imports for Node.js built-ins and proper usage of the
@lynx-jspackage APIs. Based on learnings, the default import pattern for Node.js modules is the preferred style in this repository.
11-14: LGTM!Standard ESM pattern for resolving the
@lynx-js/reactpackage location usingcreateRequirewithimport.meta.url.
16-54: LGTM!Configuration is well-structured:
- Module rules correctly apply layer-specific loaders using
LAYERS.BACKGROUNDandLAYERS.MAIN_THREAD- Production-appropriate define values for the bundle
pluginReactAliasconfigured with requiredLAYERSandrootPathoptions
55-78: LGTM!Output configuration is appropriate for an external bundle:
dataUriLimit: Number.POSITIVE_INFINITYensures assets are inlined- Comprehensive externals mapping for the Lynx React ecosystem modules to the
ReactLynxglobal namespaceminify: falseis reasonable since downstream consumers can handle minification
…ily#1924) <!-- 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 * **Externals Loading Plugin for Webpack**: Introduced a new Webpack plugin enabling dynamic external module loading for Lynx applications. The plugin provides support for both asynchronous and synchronous loading modes, automatically handles deduplication of external libraries by name, and offers flexible layer-based configuration for differentiating loading behavior between background and main-thread execution contexts. <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). --------- Co-authored-by: Yiming Li <yimingli.cs@gmail.com>
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/gesture-runtime@2.1.0 ### Minor Changes - Initialize `'@lynx-js/gesture-runtime` ([#1984](#1984)) ## @lynx-js/rspeedy@0.12.3 ### Patch Changes - Support environment variants to enable multiple configurations for the same targets. ([#1969](#1969)) - Updated dependencies \[]: - @lynx-js/web-rsbuild-server-middleware@0.19.2 ## @lynx-js/lynx-bundle-rslib-config@0.0.2 ### Patch Changes - Introduce `@lynx-js/externals-loading-webpack-plugin`. It will help you to load externals built by `@lynx-js/lynx-bundle-rslib-config`. ([#1924](#1924)) ```js // webpack.config.js import { ExternalsLoadingPlugin } from "@lynx-js/externals-loading-webpack-plugin"; export default { plugins: [ new ExternalsLoadingPlugin({ mainThreadLayer: "main-thread", backgroundLayer: "background", externals: { lodash: { url: "http://lodash.lynx.bundle", background: { sectionPath: "background" }, mainThread: { sectionPath: "main-thread" }, }, }, }), ], }; ``` ## @lynx-js/react-rsbuild-plugin@0.12.2 ### Patch Changes - Support environment variants to enable multiple configurations for the same targets. ([#1969](#1969)) - Updated dependencies \[]: - @lynx-js/react-alias-rsbuild-plugin@0.12.2 ## @lynx-js/web-constants@0.19.2 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-worker-rpc@0.19.2 ## @lynx-js/web-core@0.19.2 ### Patch Changes - chore: mark the "multi-thread" deprecated ([#2030](#2030)) **NOTICE This will be a breaking change in the future** mark the thread strategy "multi-thread" as deprecated. Please use "all-on-ui" instead. If you still want to use multi-thread mode, please try to use a cross-origin isolated iframe. A console warning will be printed if `thread-strategy` is set to `multi-thread`. - fix csp issue for mts realm ([#1998](#1998)) - Updated dependencies \[]: - @lynx-js/web-constants@0.19.2 - @lynx-js/web-mainthread-apis@0.19.2 - @lynx-js/web-worker-rpc@0.19.2 - @lynx-js/web-worker-runtime@0.19.2 ## @lynx-js/web-explorer@0.0.15 ### Patch Changes - fix: web-explorer needs to actively send an iframeReady message to the parent, the parent uses `iframe load` listener cannot guarantee that the `message-listener` will complete execution. ([#2001](#2001)) ## @lynx-js/web-mainthread-apis@0.19.2 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.19.2 ## @lynx-js/web-worker-runtime@0.19.2 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.19.2 - @lynx-js/web-mainthread-apis@0.19.2 - @lynx-js/web-worker-rpc@0.19.2 ## @lynx-js/externals-loading-webpack-plugin@0.0.1 ### Patch Changes - Introduce `@lynx-js/externals-loading-webpack-plugin`. It will help you to load externals built by `@lynx-js/lynx-bundle-rslib-config`. ([#1924](#1924)) ```js // webpack.config.js import { ExternalsLoadingPlugin } from "@lynx-js/externals-loading-webpack-plugin"; export default { plugins: [ new ExternalsLoadingPlugin({ mainThreadLayer: "main-thread", backgroundLayer: "background", externals: { lodash: { url: "http://lodash.lynx.bundle", background: { sectionPath: "background" }, mainThread: { sectionPath: "main-thread" }, }, }, }), ], }; ``` ## create-rspeedy@0.12.3 ## @lynx-js/react-alias-rsbuild-plugin@0.12.2 ## upgrade-rspeedy@0.12.3 ## @lynx-js/web-core-server@0.19.2 ## @lynx-js/web-rsbuild-server-middleware@0.19.2 ## @lynx-js/web-worker-rpc@0.19.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Examples
Documentation
Packaging
Tests
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist