Skip to content

Conversation

@upupming
Copy link
Collaborator

@upupming upupming commented Jul 8, 2025

Summary

In chunk split, extractStr will not work as expected. So we will report an error on both extractStr and chunk split is enabled.

For example, if a lib-preact is shared by entry A and entry B, they have different __EXTRACT_STR__ array and index. if lib-preact follows the __EXTRACT_STR__ of entry A, it will not work an entry B.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Summary by CodeRabbit

  • Bug Fixes

    • String extraction is now automatically disabled when the chunk splitting strategy is not "all-in-one".
    • A warning message is shown when string extraction is forcibly disabled due to an incompatible chunk splitting strategy.
  • Tests

    • Added tests to verify string extraction behavior across different chunk splitting strategies.

@upupming upupming requested a review from colinaaa as a code owner July 8, 2025 12:58
@changeset-bot
Copy link

changeset-bot bot commented Jul 8, 2025

🦋 Changeset detected

Latest commit: 6c957b6

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

This PR includes changesets to release 2 packages
Name Type
@lynx-js/react-rsbuild-plugin Patch
@lynx-js/react-alias-rsbuild-plugin 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 gaoachao July 8, 2025 12:59
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 8, 2025

CodSpeed Performance Report

Merging #1251 will not alter performance

Comparing upupming:feat/extractStr-chunkSplit (6c957b6) with main (a1efa6a)

Summary

✅ 10 untouched benchmarks

@relativeci
Copy link

relativeci bot commented Jul 8, 2025

Web Explorer

#2955 Bundle Size — 303.56KiB (0%).

6c957b6(current) vs a1efa6a main#2947(baseline)

Bundle metrics  Change 1 change
                 Current
#2955
     Baseline
#2947
No change  Initial JS 139.94KiB 139.94KiB
No change  Initial CSS 31.88KiB 31.88KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 4 4
No change  Assets 5 5
Change  Modules 205(-0.49%) 206
No change  Duplicate Modules 17 17
No change  Duplicate Code 4.23% 4.23%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#2955
     Baseline
#2947
No change  JS 220.79KiB 220.79KiB
No change  Other 50.89KiB 50.89KiB
No change  CSS 31.88KiB 31.88KiB

Bundle analysis reportBranch upupming:feat/extractStr-chunkSp...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Jul 8, 2025

React Example

#2964 Bundle Size — 234.12KiB (0%).

6c957b6(current) vs a1efa6a main#2956(baseline)

Bundle metrics  no changes
                 Current
#2964
     Baseline
#2956
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 153 153
No change  Duplicate Modules 61 61
No change  Duplicate Code 45.85% 45.85%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#2964
     Baseline
#2956
No change  IMG 145.76KiB 145.76KiB
No change  Other 88.37KiB 88.37KiB

Bundle analysis reportBranch upupming:feat/extractStr-chunkSp...Project dashboard


Generated by RelativeCIDocumentationReport issue

gaoachao
gaoachao previously approved these changes Jul 9, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 9, 2025

Walkthrough

A conditional override was introduced for the extractStr option in the React plugin configuration. Now, if chunk splitting is not set to 'all-in-one', extractStr is forcibly set to false with a warning. Tests were added to verify this behavior, and a new changeset documents the update.

Changes

File(s) Change Summary
.changeset/twelve-dancers-learn.md Added a changeset documenting the conditional override of extractStr based on chunk splitting.
packages/rspeedy/plugin-react/src/entry.ts Modified applyEntry to rename extractStr param, override it conditionally, and log a warning.
packages/rspeedy/plugin-react/test/config.test.ts Added tests verifying extractStr override behavior under different chunkSplit.strategy values.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PluginConfig
    participant Logger

    User->>PluginConfig: Set extractStr = true and chunkSplit.strategy != 'all-in-one'
    PluginConfig->>PluginConfig: Detect incompatible options
    PluginConfig->>Logger: Log warning "extractStr only supported with 'all-in-one'"
    PluginConfig->>PluginConfig: Override extractStr = false
    PluginConfig-->>User: Use modified config
Loading

Suggested reviewers

  • colinaaa

Poem

A rabbit hopped in code so neat,
Tweaked extractStr for a better feat.
If chunks don’t split all-in-one,
False it becomes—no need to run!
With tests in place, the logic’s tight—
This patch will keep the build just right.
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

 ERROR  Cannot resolve version $@rspack/core in overrides. The direct dependencies don't have dependency "@rspack/core".
For help, run: pnpm help install


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f36739e and 6c957b6.

📒 Files selected for processing (1)
  • packages/rspeedy/plugin-react/src/entry.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/rspeedy/plugin-react/src/entry.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jul 9, 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!

@upupming upupming requested a review from colinaaa July 15, 2025 04:08
@upupming upupming requested a review from colinaaa July 16, 2025 05:32
@colinaaa colinaaa added this pull request to the merge queue Jul 16, 2025
Merged via the queue into lynx-family:main with commit a862edb Jul 16, 2025
44 checks passed
colinaaa pushed a commit that referenced this pull request Jul 19, 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/[email protected]

### Patch Changes

- Optimize `componentAtIndex` by a few hundreds microseconds: avoiding
manipulate `__pendingListUpdates` unless SnapshotInstance tree is
changed ([#1201](#1201))

- Support alog of component rendering on production for better error
reporting. Enable it by using `REACT_ALOG=true rspeedy dev/build` or
defining `__ALOG__` to `true` in `lynx.config.js`:
([#1164](#1164))

    ```js
    export default defineConfig({
      // ...
      source: {
        define: {
          __ALOG__: true,
        },
      },
    });
    ```

- Make `preact/debug` work with `@lynx-js/react`.
([#1222](#1222))

- Introduce `@lynx-js/react/debug` which would include debugging
warnings and error messages for common mistakes found.
([#1250](#1250))

Add the import to `@lynx-js/react/debug` at the first line of the entry:

    ```js
    import "@lynx-js/react/debug";
    import { root } from "@lynx-js/react";

    import { App } from "./App.jsx";

    root.render(<App />);
    ```

- `<list-item/>` deferred now accepts an object with `unmountRecycled`
property to control unmounting behavior when the item is recycled.
([#1302](#1302))

    For example, you can use it like this:

    ```jsx
    <list-item defer={{ unmountRecycled: true }} item-key="1">
      <WillBeUnmountIfRecycled />
    </list-item>
    ```

Now the component will be unmounted when it is recycled, which can help
with performance in certain scenarios.

- Avoid some unexpected `__SetAttribute` in hydrate when `undefined` is
passed as an attribute value to intrinsic elements, for example:
([#1318](#1318))

    ```jsx
    <image async-mode={undefined} />
    ```

## @lynx-js/[email protected]

### Patch Changes

- Bump Rsbuild v1.4.6 with Rspack v1.4.8.
([#1282](#1282))

## [email protected]

### Patch Changes

- Add `import '@lynx-js/react/debug'` for all templates.
([#1250](#1250))

## @lynx-js/[email protected]

### Patch Changes

- Fix "TypeError: cannot read property 'call' of undefined" error during
HMR updates.
([#1304](#1304))

- Supports extractStr for large JSON
([#1230](#1230))

- Change `extractStr` to `false` when `performance.chunkSplit.strategy`
is not `all-in-one`.
([#1251](#1251))

- Updated dependencies
\[[`cb7feb6`](cb7feb6),
[`ec7228f`](ec7228f)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Support `@lynx-js/react/debug`.
([#1250](#1250))

## @lynx-js/[email protected]

### Patch Changes

- Support alog of component rendering on production for better error
reporting. Enable it by using `REACT_ALOG=true rspeedy dev/build` or
defining `__ALOG__` to `true` in `lynx.config.js`:
([#1164](#1164))

    ```js
    export default defineConfig({
      // ...
      source: {
        define: {
          __ALOG__: true,
        },
      },
    });
    ```

- Supports `console.alog` and use different `console` object in main
thread and background thread.
([#1164](#1164))

## @lynx-js/[email protected]

### Patch Changes

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and
\_\_GetTemplateParts for all-on-ui
([#1275](#1275))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support SSR for all-on-ui
([#1029](#1029))

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and
\_\_GetTemplateParts for all-on-ui
([#1275](#1275))

- feat: mark template elements for SSR and update part ID handling
([#1286](#1286))

- Updated dependencies
\[[`cebda59`](cebda59),
[`1443e46`](1443e46),
[`5062128`](5062128),
[`f656b7f`](f656b7f)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support SSR for all-on-ui
([#1029](#1029))

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: dump the event info on ssr stage
([#1237](#1237))

- feat: mark template elements for SSR and update part ID handling
([#1286](#1286))

## @lynx-js/[email protected]

### Patch Changes

- fix: indicator dots' bg-color on safari 26
([#1298](#1298))

    <https://bugs.webkit.org/show_bug.cgi?id=296048>
    The animation name should be defined in the template

- fix: list may only render only one column in ReactLynx.
([#1280](#1280))

This is because `span-count` may not be specified when `list-type` is
specified, resulting in layout according to `span-count="1"`. Postponing
the acquisition of `span-count` until layoutListItem can solve this
problem.

- Updated dependencies
\[[`443f3d5`](443f3d5)]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- fix: indicator dots' bg-color on safari 26
([#1298](#1298))

    <https://bugs.webkit.org/show_bug.cgi?id=296048>
    The animation name should be defined in the template

## @lynx-js/[email protected]

### Patch Changes

- feat: support SSR for all-on-ui
([#1029](#1029))

- feat: move SSR hydrate essential info to the ssr attribute
([#1292](#1292))

We found that in browser there is no simple tool to decode a base64
string

    Therefore we move the data to `ssr` attribute

    Also fix some ssr issues

- feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and
\_\_GetTemplateParts for all-on-ui
([#1275](#1275))

- feat: mark template elements for SSR and update part ID handling
([#1286](#1286))

- Updated dependencies
\[[`1443e46`](1443e46),
[`5062128`](5062128)]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Updated dependencies
\[[`cebda59`](cebda59),
[`1443e46`](1443e46),
[`5062128`](5062128),
[`f656b7f`](f656b7f)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Fix the `Syntax Error: expecting ';'` error of chunk splitting
([#1279](#1279))

## [email protected]



## @lynx-js/[email protected]

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