Skip to content

feat: warn user if config includes cjs format#403

Merged
sxzz merged 9 commits intomainfrom
feat/warn-cjs
Aug 4, 2025
Merged

feat: warn user if config includes cjs format#403
sxzz merged 9 commits intomainfrom
feat/warn-cjs

Conversation

@Gugustinette
Copy link
Collaborator

Description

Inform the user when using the cjs format.

Linked Issues

Resolves #260

Additional context

  • Not sure about the phrasing I used
  • I added a link to this paragraph from the Node.js website, but I'm sure there could be a better blog post about the ESM/CJS situation ? I'm honestly not confident enough to write a good one

@TheAlexLichter 🙌

@netlify
Copy link

netlify bot commented Aug 1, 2025

Deploy Preview for tsdown ready!

Name Link
🔨 Latest commit 0f8c983
🔍 Latest deploy log https://app.netlify.com/projects/tsdown/deploys/6890d79cb5fd2a00098e40a9
😎 Deploy Preview https://deploy-preview-403--tsdown.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 Aug 1, 2025

Open in StackBlitz

npm i https://pkg.pr.new/tsdown@403

commit: 0f8c983

@Gugustinette Gugustinette requested a review from sxzz August 1, 2025 19:11
Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

Only warn when target > v23.0.0 or v22.12.0.

export function resolvePackageTarget(pkg?: PackageJson): string | undefined {
const nodeVersion = pkg?.engines?.node
if (!nodeVersion) return
const nodeMinVersion = minVersion(nodeVersion)
if (!nodeMinVersion) return
if (nodeMinVersion.version === '0.0.0') return
return `node${nodeMinVersion.version}`
}

@Gugustinette
Copy link
Collaborator Author

Not sure about my target/semver usage @sxzz 😭

@sxzz sxzz mentioned this pull request Aug 1, 2025
@Gugustinette Gugustinette requested a review from sxzz August 4, 2025 14:18
@sxzz sxzz merged commit bd42eda into main Aug 4, 2025
9 checks passed
@sxzz sxzz deleted the feat/warn-cjs branch August 4, 2025 15:46
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.

Info/Warn when CJS is used

3 participants