Skip to content

fix(node-protocol): respect alias and tsconfig paths when stripping node: prefix#773

Open
lazuee wants to merge 3 commits intorolldown:mainfrom
lazuee:main
Open

fix(node-protocol): respect alias and tsconfig paths when stripping node: prefix#773
lazuee wants to merge 3 commits intorolldown:mainfrom
lazuee:main

Conversation

@lazuee
Copy link

@lazuee lazuee commented Feb 19, 2026

Description

When nodeProtocol: "strip" is configured, the NodeProtocolPlugin runs with order: 'pre' and immediately marks stripped node: imports as external: true. This short-circuits the entire resolution chain, so alias and tsconfig paths configurations that map the stripped module name (e.g., crypto) to a polyfill are never consulted.

The fix changes the strip handler to call this.resolve() with the stripped ID before marking it as external. If another resolver (alias, tsconfig paths) resolves it to a non-external module, that resolution is used instead.

Linked Issues

Fixes #772

Additional context

The test covers both resolution methods in a single case:

  • alias: node:path → stripped to path → resolved via alias to a polyfill
  • tsconfig paths: node:crypto → stripped to crypto → resolved via paths to a polyfill

@netlify
Copy link

netlify bot commented Feb 19, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 769cedc
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6997346b4374d800086eb621
😎 Deploy Preview https://deploy-preview-773--tsdown-main.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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 19, 2026

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/tsdown@773 -D
npm i https://pkg.pr.new/tsdown@773 -D
yarn add https://pkg.pr.new/tsdown@773.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/create-tsdown@773 -D
npm i https://pkg.pr.new/create-tsdown@773 -D
yarn add https://pkg.pr.new/create-tsdown@773.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/tsdown-migrate@773 -D
npm i https://pkg.pr.new/tsdown-migrate@773 -D
yarn add https://pkg.pr.new/tsdown-migrate@773.tgz -D

commit: 769cedc

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.

nodeProtocol: "strip" ignores paths resolution for stripped node: imports

2 participants

Comments