-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
docs: add environment.fetchModule documentation (#21500) #21529
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| `environment.fetchModule` | ||
|
|
||
| `fetchModule` is an internal utility available on environmetances in Vite. |
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.
Typo: 'environmetances' should be 'environment instances' or 'environments'.
-`fetchModule` is an internal utility available on environmetances in Vite.
+`fetchModule` is an internal utility available on environment instances in Vite.This typo will make the documentation confusing and unprofessional.
| `fetchModule` is an internal utility available on environmetances in Vite. | |
| `fetchModule` is an internal utility available on environment instances in Vite. |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| `environment.fetchModule` | ||
|
|
||
| `fetchModule` is an internal utility available on environmetances in Vite. | ||
| It allows plor custom environments to dynamically load a module by ID, |
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.
Typo: 'plor' should be 'plugins or'.
-It allows plor custom environments to dynamically load a module by ID,
+It allows plugins or custom environments to dynamically load a module by ID,This typo breaks the sentence readability and will confuse users reading the documentation.
| It allows plor custom environments to dynamically load a module by ID, | |
| It allows plugins or custom environments to dynamically load a module by ID, |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| const mod = await environment.fetchModule('/src/foo.js') | ||
| console.log(mod.default) |
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.
Was this AI generated? Because this is wrong. FetchResult is a union of three types, so using this code isn't type safe and you'll get a compiler error.
EDIT: after checking the second edit, I can confirm this is AI generated, with poor prompting given to the agent. I suggest the intervention of a human. One thing I'd like to see addressed is how to interpret the different variants of FetchResult, and make it type safe
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.
I'm sorry, I understand. I'll correct it immediately.
What
Add documentation for
environment.fetchModulein the Environment API docs.Why
Issue #21500 requested documentation for this API, which is currently undocumented.
This function allows plugins and custom environments to dynamically load modules by ID.
Changes
environment.fetchModulemethod description under DevEnvironmentenvironment.fetchModulefunction #21500Example
Notes
environment.fetchModulefunction #21500