Skip to content

fix(webpack/external): globDynamicComponentEntry is not defined#2058

Merged
colinaaa merged 1 commit intomainfrom
fix/externals-globDynamicComponentEntry
Dec 26, 2025
Merged

fix(webpack/external): globDynamicComponentEntry is not defined#2058
colinaaa merged 1 commit intomainfrom
fix/externals-globDynamicComponentEntry

Conversation

@upupming
Copy link
Copy Markdown
Collaborator

@upupming upupming commented Dec 25, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a runtime error ("globDynamicComponentEntry is not defined") that occurred when minification was enabled for external bundle consumers.

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

Checklist

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

@upupming upupming requested a review from colinaaa as a code owner December 25, 2025 12:22
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 25, 2025

🦋 Changeset detected

Latest commit: 45a5dc0

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

This PR includes changesets to release 1 package
Name Type
@lynx-js/lynx-bundle-rslib-config Patch

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

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

@upupming upupming requested a review from luhc228 December 25, 2025 12:23
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 25, 2025

📝 Walkthrough

Walkthrough

Adds a changeset entry and updates the emitted BannerPlugin wrapper in MainThreadRuntimeWrapperWebpackPlugin.ts by inserting a TODO comment and a new variable declaration var globDynamicComponentEntry = '__Card__'; into the wrapper banner to address a runtime error under minification.

Changes

Cohort / File(s) Summary
Changeset documentation
\.changeset/tired-knives-cross.md
Patch entry for @lynx-js/lynx-bundle-rslib-config describing a fix for a runtime error when minify is enabled.
Runtime wrapper banner
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
Banner wrapper string expanded to include a TODO comment and var globDynamicComponentEntry = '__Card__'; before module/exports initialization; rest of wrapper preserved.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • colinaaa

Poem

🐰 In the minifier's maze I hopped with glee,
Planted a name so the code runs free,
A tiny var, a TODO note bright,
Now bundles behave through day and night —
Hop, fix, ship! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: addressing the undefined 'globDynamicComponentEntry' identifier in webpack external bundle configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/externals-globDynamicComponentEntry

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 135ca7a and 45a5dc0.

📒 Files selected for processing (2)
  • .changeset/tired-knives-cross.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/tired-knives-cross.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts

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

❤️ Share

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

luhc228
luhc228 previously approved these changes Dec 25, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 25, 2025

Codecov Report

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

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Dec 25, 2025

CodSpeed Performance Report

Merging #2058 will improve performance by 5.38%

Comparing fix/externals-globDynamicComponentEntry (45a5dc0) with main (cd89bf9)

Summary

⚡ 1 improvement
✅ 62 untouched
⏩ 3 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
basic-performance-div-100 6.3 ms 6 ms +5.38%

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Dec 25, 2025

Web Explorer

#6864 Bundle Size — 376.4KiB (0%).

45a5dc0(current) vs 7903c9e main#6863(baseline)

Bundle metrics  Change 1 change
                 Current
#6864
     Baseline
#6863
No change  Initial JS 149.87KiB 149.87KiB
No change  Initial CSS 32.4KiB 32.4KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 231(-0.43%) 232
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.12% 3.12%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6864
     Baseline
#6863
No change  JS 247.01KiB 247.01KiB
No change  Other 96.98KiB 96.98KiB
No change  CSS 32.4KiB 32.4KiB

Bundle analysis reportBranch fix/externals-globDynamicCompone...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Dec 25, 2025

React Example

#6704 Bundle Size — 237.01KiB (0%).

45a5dc0(current) vs 7903c9e main#6703(baseline)

Bundle metrics  no changes
                 Current
#6704
     Baseline
#6703
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 162 162
No change  Duplicate Modules 65 65
No change  Duplicate Code 46.75% 46.75%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6704
     Baseline
#6703
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.25KiB 91.25KiB

Bundle analysis reportBranch fix/externals-globDynamicCompone...Project dashboard


Generated by RelativeCIDocumentationReport issue

@upupming upupming force-pushed the fix/externals-globDynamicComponentEntry branch from 135ca7a to 45a5dc0 Compare December 25, 2025 13:23
@luhc228 luhc228 self-requested a review December 25, 2025 13:24
@colinaaa colinaaa merged commit f0317a3 into main Dec 26, 2025
65 of 67 checks passed
@colinaaa colinaaa deleted the fix/externals-globDynamicComponentEntry branch December 26, 2025 07:03
colinaaa pushed a commit that referenced this pull request Dec 29, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/lynx-bundle-rslib-config@0.1.0

### Minor Changes

- Update external bundle minimum SDK version to 3.5.
([#2037](#2037))

### Patch Changes

- Fix `globDynamicComponentEntry is not defined` error when minify is
enabled in external bundle consumer.
([#2058](#2058))

## @lynx-js/web-elements@0.10.0

### Minor Changes

- chore: migrate all @lynx-js/web-elements-\* packages into one
([#2057](#2057))

    ### Before

    ```js
    import "@lynx-js/web-elements-template";
    import "@lynx-js/web-elements-compat/LinearContainer";
    ```

    ### After

    ```js
    import "@lynx-js/web-elements/html-templates";
    import "@lynx-js/web-elements/compat/LinearContainer";
    ```

### Patch Changes

- refactor: change code structure for improved readability and
maintainability
([#2004](#2004))

    -   enable noUnusedLocals for web-elements
    -   add source field for supporting @rsbuild/plugin-source-build

    This is a part of #1937

## @lynx-js/react@0.115.2

### Patch Changes

- Fix `undefined factory
(react:background)/./node_modules/.pnpm/@lynx-js+react...` error when
loading a standalone lazy bundle after hydration.
([#2048](#2048))

- Partially fix "main-thread.js exception: TypeError: cannot read
property '\_\_elements' of undefined" by recursively calling
`snapshotDestroyList`.
([#2041](#2041))

- Fix a bug where React throws `CtxNotFound` error when lazy bundle
resolves after unmount.
([#2003](#2003))

## @lynx-js/rspeedy@0.12.4

### Patch Changes

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

## @lynx-js/external-bundle-rsbuild-plugin@0.0.1

### Patch Changes

- Introduce `@lynx-js/external-bundle-rsbuild-plugin`.
([#2006](#2006))

    ```ts
    // lynx.config.ts
import { pluginExternalBundle } from
"@lynx-js/external-bundle-rsbuild-plugin";
    import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";

    export default {
      plugins: [
        pluginReactLynx(),
        pluginExternalBundle({
          externals: {
            lodash: {
              url: "http://lodash.lynx.bundle",
              background: { sectionPath: "background" },
              mainThread: { sectionPath: "mainThread" },
            },
          },
        }),
      ],
    };
    ```

- Updated dependencies
\[[`491c5ef`](491c5ef)]:
    -   @lynx-js/externals-loading-webpack-plugin@0.0.2

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

### Patch Changes

- expose LAYERS via `api.expose` for other rsbuild plugins.
([#2006](#2006))

- Updated dependencies
\[[`cd89bf9`](cd89bf9)]:
    -   @lynx-js/template-webpack-plugin@0.10.1
    -   @lynx-js/react-alias-rsbuild-plugin@0.12.3
    -   @lynx-js/use-sync-external-store@1.5.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.4
    -   @lynx-js/react-webpack-plugin@0.7.3
    -   @lynx-js/css-extract-webpack-plugin@0.7.0

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

### Patch Changes

- Updated dependencies
\[[`986761d`](986761d)]:
    -   @lynx-js/web-worker-rpc@0.19.3

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

### Patch Changes

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

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

### Patch Changes

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

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

### Patch Changes

- feat: support lazy message port assigning in web-worker-rpc
([#2040](#2040))

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

### Patch Changes

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

## @lynx-js/externals-loading-webpack-plugin@0.0.2

### Patch Changes

- Export `ExternalValue` ts type.
([#2037](#2037))

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

### Patch Changes

- fix: pass updated css from encodeData to resolvedEncodeOptions
([#2053](#2053))

Previously, the initial CSS was used in resolvedEncodeOptions instead of
the potentially updated CSS from encodeData after the beforeEncode hook.
This fix ensures resolvedEncodeOptions receives the latest CSS data.

## create-rspeedy@0.12.4



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



## upgrade-rspeedy@0.12.4



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



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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants