docs(guides): add import.defer() context module example to lazy loadi…#7982
Merged
alexander-akait merged 3 commits intoMar 11, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| }); | ||
| ``` | ||
|
|
||
| In this example, the locale module is loaded and parsed, but its evaluation is deferred until you access the namespace object. This allows you to load multiple locale files without executing them immediately. |
Member
There was a problem hiding this comment.
Before description was more useful, I think better to rewrite it union your and this
Member
Author
There was a problem hiding this comment.
Thanks for the suggestion! I combined the previous explanation with the updated wording.
Member
Author
|
Commited some changes regarding fixing the lint issue test due to import.defer(). |
alexander-akait
approved these changes
Mar 11, 2026
pranjalisr
pushed a commit
to pranjalisr/webpack.js.org
that referenced
this pull request
Mar 12, 2026
webpack#7982) * docs(guides): add import.defer() context module example to lazy loading guide * docs(guides): fix eslint error and address maintainer review on closing sentence * docs(guides): use text fence for import.defer() block to fix eslint parse error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces the incomplete import.defer() context module example in the lazy loading guide as the previous code block contained a commented out call (// const modules = import.defer(...)) that was never finished, leaving the section without a working example. The new example shows deferred evaluation of locale modules selected via a dynamic path expression, demonstrating how webpack includes all matching modules in the module graph while deferring execution until a property is first accessed.
What kind of change does this PR introduce?
Docs change
Did you add tests for your changes?
No
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?
The import.defer() context module support was shipped in webpack 5.105 and documented in the release blog post, but the corresponding section in the lazy loading guide was left with a stub example and this PR closes that gap directly in the guide.
Use of AI
N/A