[node-resolve] Replace `resolve` and some rollup-baked `exports` fields handling with a Rust-based resolver

Open
#1,874 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
javascript, rust

Research direction

Start with @rollup/plugin-node-resolve and review how it currently relies on resolve, including its extra browser-field and export-map handling. Compare the mentioned oxc-resolver and rspack-resolver options, then establish whether a Rust-based replacement preserves those behaviors and improves performance before considering Rollup core.

Written by the indexing model from the issue text.

Description

  • Rollup Plugin Name: @rollup/plugin-node-resolve
  • Rollup Plugin Version: 16.0.1
Feature Use Case

Currently, @rollup/plugin-node-resolve relies on resolve, a resolver created and maintained by Browserify, which hasn't been actively maintained and lacks the export map feature.

Rollup builds @rollup/plugin-node-resolve on top of resolve with extra code to handle the browser field and export map.

The resolve plugin is a hot path during the build process, ranging from 10 to thousands or even more. Rustifying the resolver could benefit performance.

Feature Proposal

Maybe Rollup could rustify the resolve part, starting with @rollup/plugin-node-resolve. It is possible to use a Rust-based resolver, like oxc-resolver or rspack-resolver directly. Rollup could also build a rollup-flavored one on top of those crates.

Also, those resolvers already support features (that resolve doesn't have) like export map and the browser field, so @rollup/plugin-node-resolve wouldn't need to re-implement those features again.

After experimenting with @rollup/plugin-node-resolve, we could then decide whether the Rollup core's built-in resolver can benefit from rustify as well.

Dominant language
JavaScript
Stars
3.8k
Forks
635
PR merge metrics
No merged PRs in 30d

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.

More from rollup/plugins

All issues in rollup/plugins

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.