Skip to content

fix: exclude shim file from bundled dependency hint#909

Merged
sxzz merged 1 commit intomainfrom
issue-907
Apr 13, 2026
Merged

fix: exclude shim file from bundled dependency hint#909
sxzz merged 1 commit intomainfrom
issue-907

Conversation

@sxzz
Copy link
Copy Markdown
Member

@sxzz sxzz commented Apr 13, 2026

  • This PR contains AI-generated code, but I have carefully reviewed it myself. Otherwise, my PR may be closed.

Description

When shims: true is enabled, tsdown injects ESM shims (__filename, __dirname) by importing from its own esm-shims.js. Since this file resides in node_modules/tsdown/, the dependency detection in generateBundle incorrectly flags tsdown as a bundled dependency and shows a confusing hint. This PR skips the shimFile when iterating module IDs so the shim import is not reported.

Linked Issues

Closes #907

Additional context

The shimFile was already excluded in externalStrategy() during the resolveId phase, but the generateBundle hook runs independently and was missing the same filter.

When shims: true is enabled, tsdown injects ESM shims (__filename,
__dirname) by importing from its own esm-shims.js. Since this file
resides in node_modules/tsdown/, the dependency detection in
generateBundle incorrectly flags tsdown itself as a bundled dependency
and shows a confusing hint suggesting the user configure deps.onlyBundle.

Skip the shimFile when iterating module IDs in the generateBundle
handler so the shim import is not reported as a bundled dependency.

Closes #907
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 13, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit aa44008
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69dce9a9743788000836af0a
😎 Deploy Preview https://deploy-preview-909--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.

@sxzz sxzz enabled auto-merge (squash) April 13, 2026 13:03
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: aa44008

@sxzz sxzz disabled auto-merge April 13, 2026 13:05
@sxzz sxzz merged commit 3f8de4c into main Apr 13, 2026
15 checks passed
@sxzz sxzz deleted the issue-907 branch April 13, 2026 13:05
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.

feature-request: add tsdown shim to bundle whitelist to prevent bundle hint

1 participant