-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: correct customization hook types & clarify descriptions #56454
base: main
Are you sure you want to change the base?
doc: correct customization hook types & clarify descriptions #56454
Conversation
Review requested:
|
Fast-track has been requested by @JakobJingleheimer. Please 👍 to approve. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #56454 +/- ##
=======================================
Coverage 88.53% 88.54%
=======================================
Files 657 657
Lines 190724 190788 +64
Branches 36600 36613 +13
=======================================
+ Hits 168867 168924 +57
- Misses 15031 15043 +12
+ Partials 6826 6821 -5
|
@@ -1143,12 +1143,13 @@ changes: | |||
* `context` {Object} | |||
* `conditions` {string\[]} Export conditions of the relevant `package.json` | |||
* `format` {string|null|undefined} The format optionally supplied by the | |||
`resolve` hook chain | |||
`resolve` hook chain. This can be any string value, not necessarily a valid return value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit confusing... in particular the second part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
is both an input and an output of this function. The input is not necessarily a valid output.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
ignored) | ||
`'builtin' | 'commonjs' | 'json' | 'module' | 'wasm'` | ||
* `format` {string|null|undefined} A hint to the `load` hook (it might be ignored). It can be any | ||
string value (`'css'`, `'yaml'`, etc). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit odd to offer examples of formats that Node doesn't support. Maybe use only supported ones, or write something like "string value (supported such as json
or unsupported such as css
)"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This would commonly be a [module format](link to the module formats table), but could also be any arbitrary string."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit odd to offer examples of formats that Node doesn't support.
Actually, it's the opposite—it's the purpose of this feature: One of the main utilities of loaders is to extend what node can support. It's actually far less common to set ResolveFnOutput.format
to a module format.
But how about
* `format` {string|null|undefined} A hint to the `load` hook (it might be ignored). It can be a
module format (such as `'commonjs'` or `'module'`) or an arbitrary value like `'css'` or `'yaml'`.
No description provided.