Skip to content

feat: support import.defer() for context module#20399

Merged
alexander-akait merged 5 commits intowebpack:mainfrom
ahabhgk:dynamic-import-defer-context
Feb 3, 2026
Merged

feat: support import.defer() for context module#20399
alexander-akait merged 5 commits intowebpack:mainfrom
ahabhgk:dynamic-import-defer-context

Conversation

@ahabhgk
Copy link
Contributor

@ahabhgk ahabhgk commented Feb 3, 2026

Summary

support import.defer() for context module:

const file = Math.random() > 0.5 ? "a.js" : "b.js";
import.defer("./dir/" + file);

What kind of change does this PR introduce?

feature

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

If relevant, what needs to be documented once your changes are merged or what have you already documented?

With #20064 now webpack has full support for import.defer(), we can document that

@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: bed44fa

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

This PR includes changesets to release 1 package
Name Type
webpack Minor

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

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 3, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks


Comparing ahabhgk:dynamic-import-defer-context (bed44fa) with main (5ecc58d)

Open in CodSpeed

@alexander-akait alexander-akait merged commit 7b3b0f7 into webpack:main Feb 3, 2026
47 of 51 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

This PR is packaged and the instant preview is available (7b3b0f7).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@7b3b0f7
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@7b3b0f7
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@7b3b0f7

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.

2 participants