rollup / rollup/rollup

Ability to use other plugin's transformers

Open
#5,903 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

t³ ✨ enhancement t⁸ ⋅ triage
Dominant language
JavaScript
Stars
26.3k
Forks
1.8k
Avg merge
2d 11h
Merged PRs (30d)
20

Description

Feature Use Case

If I have a transform that converts, say, MDX to TypeScript, what's the best way to have the resulting code pass through all the transforms TypeScript would go though according to the project config?

Feature Proposal

Right now I'm 'hacking' it by writing a resolver that appends .tsx to the resolved path, then a loader that loads the right file. That means the other transformers think the file ends in .tsx and do the right thing. But… it feels like there should be an easier way.

One way could be to allow a transform to return a new path value that would be used by subsequent transformers.

Another way would be to allow something like const result = await this.transform(value, path) that runs through all the transformers, similar to what this.resolve provides for resolving.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by tracing the plugin transform and resolve hooks described in the proposal. Compare the proposed path-return and nested-transform approaches, then identify the intended API and tests needed to show that transformed output passes through the configured TypeScript transformers.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.