Add a way to add description to virtual modules
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 89
- Avg merge
- 18h 46m
- Merged PRs (30d)
- 24
Description
Clear and concise description of the problem
I think it would be helpful for users if there's a description for each virtual modules. For example:
rolldown/runtime.js: rolldown's utilty functions that are used in the bundlevite/modulepreload-polyfill.js: Vite's modulepreload polyfill. See https://vite.dev/config/build-options#build-modulepreload./src/App.vue?vue&type=script&setup=true&lang.ts:<script>block of./src/App.vue
Suggested solution
Recommend plugins to add meta.devtools.description values in load hook.
const p = {
name: 'foo',
load(id) {
return { code: content, meta: { devtools: { description: 'Vite's modulepreload polyfill. See https://vite.dev/config/build-options#build-modulepreload' } } }
}
}
and make devtools will read that information.
Alternative
Add the metadata on plugin object:
const p = {
name: 'foo',
meta: {
devtools: {
virtualmodulesDescription: {
'vite/modulepreload-polyfill.js': 'Vite's modulepreload polyfill. See https://vite.dev/config/build-options#build-modulepreload',
}
}
}
}
This does not allow setting the description for dynamic virtual modules.
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the plugin load hook and the devtools handling of module metadata, focusing on the proposed meta.devtools.description value and the virtualmodulesDescription alternative. The work is done when virtual modules can expose descriptions, including dynamically created modules, and devtools display those descriptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- api, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100