Skip to content

feat(tree-shaking): track dynamic imports in object properties - #15443

Open
LingyuCoder wants to merge 1 commit into
seal/unused-export-dynamic-import-tree-shakingfrom
seal/unused-dynamic-import-tree-shaking
Open

feat(tree-shaking): track dynamic imports in object properties#15443
LingyuCoder wants to merge 1 commit into
seal/unused-export-dynamic-import-tree-shakingfrom
seal/unused-dynamic-import-tree-shaking

Conversation

@LingyuCoder

@LingyuCoder LingyuCoder commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Build on #15449 by recovering InnerGraph ownership for deferred functions stored in direct object properties.

export const feature = {
  id: createId("feature"),
  loader: () => import("./feature")
};

When feature is unused, the loader's dynamic import inherits the top-level export's usage condition and its async target can be omitted. Eager initialization still behaves normally, so side effects such as createId("feature") are preserved.

Scope

  • handles direct key-value properties whose values are arrow functions or function expressions;
  • keeps nested deferred imports under the same top-level object owner;
  • walks computed keys and eager property values outside the deferred-function owner, preserving their evaluation and side effects;
  • stays conservative at object granularity: using the object export keeps all of its deferred loaders active;
  • does not add property-level escape or usage analysis.

The generic ImportDependency condition and incremental-cache support live in the base PR, leaving this layer limited to object ownership recovery and its focused test case.

Tests

The object-property case covers arrow functions, function expressions, nested deferred functions, used owners, eager dynamic imports, and side-effectful sibling properties.

Related links

Checklist

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

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 9f9ea8f to fix(copy-plugin): reuse cache for empty rebuilds (#15448) by harpsealjs

Note

This PR is stacked on seal/unused-export-dynamic-import-tree-shaking. Sizes are compared against main, so the diff below covers the whole stack, not this PR alone.

❌ Size increased by 36.00KB from 68.37MB to 68.40MB (⬆️0.05%)

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 523.6 KB 0 0
react-1k 799.1 KB 217.5 KB 0 0
react-10k 5.3 MB 1.3 MB 0 0
react-5k 2.6 MB 662.0 KB 0 0
ui-components 4.9 MB 1.4 MB 0 0

Generated by Rsdoctor GitHub Action

@codspeed-hq

codspeed-hq Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 50 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing seal/unused-dynamic-import-tree-shaking (9f9ea8f) with seal/unused-export-dynamic-import-tree-shaking (a986b28)

Open in CodSpeed

Footnotes

  1. 47 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.

@LingyuCoder
LingyuCoder marked this pull request as ready for review September 3, 2026 09:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T13:28:16.298921Z 9f9ea8f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@LingyuCoder
LingyuCoder force-pushed the seal/unused-dynamic-import-tree-shaking branch from 00e79b0 to 34933af Compare September 3, 2026 11:27
@LingyuCoder
LingyuCoder changed the base branch from main to seal/unused-export-dynamic-import-tree-shaking September 3, 2026 11:27
@LingyuCoder LingyuCoder changed the title feat(tree-shaking): prune dynamic imports from unused exports feat(tree-shaking): track dynamic imports in object properties Sep 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34933afee9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@LingyuCoder
LingyuCoder force-pushed the seal/unused-dynamic-import-tree-shaking branch from 34933af to eb66514 Compare September 3, 2026 11:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb665149cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@LingyuCoder
LingyuCoder force-pushed the seal/unused-dynamic-import-tree-shaking branch from eb66514 to 9f9ea8f Compare September 3, 2026 13:24
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.

1 participant