-
Notifications
You must be signed in to change notification settings - Fork 111
feat(webpack-plugin): init externals-loading-webpack-plugin #1924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(webpack-plugin): init externals-loading-webpack-plugin #1924
Conversation
📝 WalkthroughWalkthroughAdds a new package Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
packages/webpack/externals-loading-webpack-plugin/test/cases.test.ts
Outdated
Show resolved
Hide resolved
...ding-webpack-plugin/test/cases/externals-loading/filter-duplicate-externals/rspack.config.js
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #1924 will not alter performanceComparing Summary
Footnotes
|
Web Explorer#6158 Bundle Size — 366.74KiB (0%).bb89724(current) vs 5eb6d94 main#6151(baseline) Bundle metrics
|
| Current #6158 |
Baseline #6151 |
|
|---|---|---|
146.2KiB |
146.2KiB |
|
32.22KiB |
32.22KiB |
|
0% |
0% |
|
8 |
8 |
|
8 |
8 |
|
220 |
220 |
|
16 |
16 |
|
3.21% |
3.21% |
|
4 |
4 |
|
0 |
0 |
Bundle size by type no changes
| Current #6158 |
Baseline #6151 |
|
|---|---|---|
240.72KiB |
240.72KiB |
|
93.8KiB |
93.8KiB |
|
32.22KiB |
32.22KiB |
Bundle analysis report Branch luhc228:feat/init-externals-load... Project dashboard
Generated by RelativeCI Documentation Report issue
d9e7e94 to
2763df2
Compare
🦋 Changeset detectedLatest commit: bb89724 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
|
0c80032 to
b69553a
Compare
b69553a to
bb89724
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ 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.
| * A webpack plugin to load externals in Lynx. Use `lynx.fetchBundle()` and `lynx.loadScript()` API to load and parse the externals. | ||
| * | ||
| * @remark | ||
| * It requires Lynx >= 3.4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we have a build time check to throw an error if targetSDKVersion < 3.4?
| * new ExternalsLoadingPlugin({ | ||
| * externals: { | ||
| * lodash: { | ||
| * libraryName: "Lodash", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can delete this config since it is only used by us internally. We can generate a unique id for each external module.
| /** | ||
| * The wait time in milliseconds. | ||
| * | ||
| * @defaultValue `100` | ||
| */ | ||
| timeout?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if the timeout is reached? I think we should add a test case that timeout is reached but load failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if the timeout is reached? I think we should add a test case that timeout is reached but load failed.
It will throw an error directly by Lynx engine.
Summary by CodeRabbit
New Features
Tests
Documentation
Chores
Checklist