docs(api): document the loader context request accessors and dependency getters - #8400
Merged
Merged
Conversation
…cy getters The loader context exposes currentRequest, previousRequest, remainingRequest, resourceFragment, getDependencies, getContextDependencies, getMissingDependencies and getLogger, none of which had an entry on the Loader Interface page. Also rename the pitch method's second parameter in the examples to previousRequest, which is the name webpack passes it under.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
Audited the Loader Interface page against webpack's own loader context —
lib/loaders/LoaderRunner.js,NormalModule#_createLoaderContext, anddeclarations/LoaderContext.d.ts. Eight members of the public context had no entry on the page:currentRequest,previousRequest,remainingRequest,resourceFragment,getDependencies,getContextDependencies,getMissingDependenciesandgetLogger(the last was described in the Logging section but had no heading, so it was not linkable or listed in the sidebar). The request values documented here were read off a real build of the page's own/abc/loader1?xyz!loader2!./resource?rrrexample rather than derived. Thepitchexamples also called their second parameterprecedingRequest; webpack passesloaderContext.previousRequestthere, so the examples now use that name.What kind of change does this PR introduce?
docs
Did you add tests for your changes?
n/a — documentation only.
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?
n/a — this PR is the documentation.
Use of AI
AI was used. Claude Code read the loader context sources and the declared
LoaderContexttype to find undocumented members, verified every request value in this PR by running a probe loader in a real webpack build, and drafted the entries; I reviewed and edited the result before pushing.Generated by Claude Code