Skip to content

docs: explain how external modules work in rolldown#8415

Closed
hyf0 wants to merge 1 commit intomainfrom
02-22-docs_explain_how_external_modules_work_in_rolldown
Closed

docs: explain how external modules work in rolldown#8415
hyf0 wants to merge 1 commit intomainfrom
02-22-docs_explain_how_external_modules_work_in_rolldown

Conversation

@hyf0
Copy link
Copy Markdown
Member

@hyf0 hyf0 commented Feb 22, 2026

No description provided.

Copy link
Copy Markdown
Member Author

hyf0 commented Feb 22, 2026


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 22, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit e354268
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/699aa243d669740008826dea
😎 Deploy Preview https://deploy-preview-8415--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hyf0 hyf0 marked this pull request as ready for review February 22, 2026 06:35
@hyf0 hyf0 requested review from Copilot and sapphi-red February 22, 2026 06:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation explaining how external modules work in Rolldown. The documentation provides an end-to-end guide covering how modules become external, how import paths are determined in the output, and how the relevant options and plugin hooks interact.

Changes:

  • Added a new in-depth guide at docs/in-depth/external-modules.md with 281 lines of comprehensive documentation
  • Added cross-references from the external and makeAbsoluteExternalsRelative option docs to the new guide
  • Updated the VitePress sidebar configuration to include the new guide in the navigation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
docs/in-depth/external-modules.md New comprehensive guide explaining external module resolution, the two-check external option behavior, plugin control via resolveId, makeAbsoluteExternalsRelative option, and the full resolution flow with special cases
packages/rolldown/src/options/docs/external.md Added cross-reference link to the new External Modules Guide for detailed explanation
packages/rolldown/src/options/docs/make-absolute-externals-relative.md Added cross-reference link to the new External Modules Guide for detailed explanation
docs/.vitepress/config.ts Added "External Modules" entry to the In-Depth sidebar navigation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this page should focus on what is done in what order, and how each option works should probably be left to each options' page.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how each option works

From my experience, I failed to understand big picture of the external modules mechanism from the previous doc. This post is for this purpose. To understand how they all work together, you have put them together and talk about how they interact with each other.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥲 I can't get what https://rolldown.rs/reference/InputOptions.makeAbsoluteExternalsRelative is talking about at first. It's too scoped.

After this article, I start to understand the https://rolldown.rs/reference/InputOptions.makeAbsoluteExternalsRelative actually make sense, but that's the issue. It's not friendly to build mental model of how external modules work.

Copy link
Copy Markdown
Member

@sapphi-red sapphi-red Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to re-organize the content here: #8457
Does this one make sense?


### Data URLs and HTTP URLs

Specifiers starting with `data:`, `http://`, `https://`, or `//` are **automatically treated as external** before the internal resolver runs, regardless of the `external` option. These IDs are not affected by `makeAbsoluteExternalsRelative`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't data: handled by the internal plugin and bundled?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let module_type = match parsed.mime {
"text/css" => ModuleType::Css,
"text/javascript" => ModuleType::Js,
"application/json" => ModuleType::Json,

dataurl plugin only handle valid/scoped dataurl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants