Feature Request: Give plugins access to import specifiers in chunk
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
Feature Use Case
Writing plugins that needs to know the original specifiers of imports in a chunk.
Feature Proposal
I am working on a plugin that operates on chunk.imports, which is an array of resolved filepaths like /path/to/my/module.
I need to know the specifier that Rollup resolved to that module, e.g. ../module. This can't caclulated because it could be infinitely many things, i.e. for path/to/my/module/sub, it could be:
..../../module../../../my/module../../../../to/my/module- etc.
Only Rollup knows what the specifier was pre-resolution, and I would like to get that information in the chunk object since it will make operating on imports a lot easier.
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 how Rollup constructs the chunk.imports array and where import specifiers are resolved before they become file paths. Determine an API shape for preserving the original specifier and define tests that verify plugins can read it from the chunk object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100