Skip to content

Conversation

@sxzz
Copy link
Member

@sxzz sxzz commented Sep 28, 2025

Description

Defaults fixedExtension to true when platform is node.

Linked Issues

Additional context

@netlify
Copy link

netlify bot commented Sep 28, 2025

Deploy Preview for tsdown ready!

Name Link
🔨 Latest commit bf400bd
🔍 Latest deploy log https://app.netlify.com/projects/tsdown/deploys/6902ce0719293b0008c19a78
😎 Deploy Preview https://deploy-preview-517--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 Sep 28, 2025

Open in StackBlitz

npm i https://pkg.pr.new/tsdown@517
npm i https://pkg.pr.new/create-tsdown@517

commit: bf400bd

@sxzz sxzz changed the title feat!: defaults fixedExtension to true if platform is node feat!: defaults fixedExtension to true when platform is node Sep 28, 2025
@sxzz sxzz force-pushed the feat/fixed-extension branch from 6b76efb to bf400bd Compare October 30, 2025 02:31
@sxzz sxzz merged commit e1168a2 into main Oct 30, 2025
17 checks passed
@sxzz sxzz deleted the feat/fixed-extension branch October 30, 2025 02:33
@RobinTail
Copy link

This should depend on type in package.json by default

@sxzz
Copy link
Member Author

sxzz commented Nov 4, 2025

See also https://bsky.app/profile/sxzz.dev/post/3lzwm2sgaus2z

@silverwind
Copy link

silverwind commented Nov 5, 2025

I see .mjs as a legacy solution and strongly prefer .js, so this change caught me by surprise.

It broke my lib because in package.json I have "exports": "./dist/index.js" which after this change pointed to a non-existing file.

@kitschpatrol
Copy link

kitschpatrol commented Nov 5, 2025

I personally agree with Bjorn Lu's take on this — but if this is to be the default behavior in tsdown, maybe the fixedExtension option flag can be exposed in the CLI?

I had a bunch of projects that worked perfectly with a vanilla tsdown command and no additional configuration, which will now require a tsdown.config.ts file to bypass this default. Appending a flag would be cleaner for these cases.

Thanks for your work!

@sxzz
Copy link
Member Author

sxzz commented Nov 5, 2025

  • All options can be overridden via CLI flags. To disable a boolean option, use --no-fixed-extension (--no-<option-name>).
  • You can also enable exports option to automatically generate exports field on package.json.

Thank you for your understanding.

@kitschpatrol
Copy link

Thanks! I didn't realize all the options are available as CLI flags, thought it was limited to https://tsdown.dev/reference/cli and what's documented in the --help output.

@molvqingtai
Copy link

Although configuration options are provided, it is still hoped that the default should follow the package.json type, or it should be the default --no-fixed-extension, generating code that is more in line with expectations in the case of minimal configuration or no configuration.

@sxzz
Copy link
Member Author

sxzz commented Nov 11, 2025

v0.16 has been released for some time now, so we can no longer change the default behavior without affecting those who have already migrated. In the future, tsdown will be more cautious when introducing breaking changes.

michaelfaith added a commit to JoshuaKGoldberg/package-json-validator that referenced this pull request Nov 12, 2025
Following rolldown/tsdown#517, `fixedExtension` is now on by default for node applications, which means that everything that it's emitting `mjs` for any esm js files and `.d.mts` for esm type declarations.
michaelfaith added a commit to JoshuaKGoldberg/package-json-validator that referenced this pull request Nov 12, 2025
…#565)

<!-- 👋 Hi, thanks for sending a PR to package-json-validator! 💖
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

- [ ] Addresses an existing open issue: fixes #000
- [ ] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/package-json-validator/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/package-json-validator/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

(This was failing in the renovate PR:
https://github.com/JoshuaKGoldberg/package-json-validator/pulls)

Following rolldown/tsdown#517, `fixedExtension`
is now on by default when the platform is node, which means that it's
emitting `mjs` for any esm js files and `.d.mts` for esm ts files.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@sxzz sxzz mentioned this pull request Nov 12, 2025
3 tasks
michaelfaith added a commit to JoshuaKGoldberg/eslint-plugin-package-json that referenced this pull request Nov 13, 2025
(This was failing in the renovate PR: #1373)

Following rolldown/tsdown#517, fixedExtension is now on by default when the platform is node, which means that it's emitting mjs for any esm js files and .d.mts for esm ts files.
michaelfaith added a commit to JoshuaKGoldberg/eslint-plugin-package-json that referenced this pull request Nov 13, 2025
…#1386)

<!-- 👋 Hi, thanks for sending a PR to eslint-plugin-package-json! 🗂
Please fill out all fields below and make sure each item is true and [x]
checked.
Otherwise we may not be able to review your PR. -->

## PR Checklist

- [ ] Addresses an existing open issue: fixes #000
- [ ] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

(This was failing in the renovate PR:
#1373)

Following rolldown/tsdown#517, `fixedExtension`
is now on by default when the platform is node, which means that it's
emitting `mjs` for any esm js files and `.d.mts` for esm ts files.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@NiklasDah
Copy link

v0.16 has been released for some time now, so we can no longer change the default behavior without affecting those who have already migrated. In the future, tsdown will be more cautious when introducing breaking changes. (@sxzz)

Would it at least be possible to update the breaking-changes section to clarify the impact of this change? The current entry:

Defaults fixedExtension to true when platform is node

doesn’t explain why this is breaking. I overlooked it and ran into unexpected bugs even after checking the release notes. Adding something like

this means that no .js-files will be created by default

retroacively, would help users better understand the impact when skimming the changelog.

@sxzz
Copy link
Member Author

sxzz commented Nov 15, 2025

The changelog has been updated in the release notes: https://github.com/rolldown/tsdown/releases/tag/v0.16.0

Thank you for your feedback!

askoufis added a commit to seek-oss/vocab that referenced this pull request Nov 16, 2025
@DopamineDriven
Copy link

This should definitely depend on type in package.json by default. That's by convention

this breaks pipelines unnecessarily

@silverwind
Copy link

I'd make it by default match the extension of the entry file. And maybe add a option outputExtension or similar so users can specify the extension they want.

@sxzz
Copy link
Member Author

sxzz commented Nov 22, 2025

You can use outExtensions

JoshuaKGoldberg added a commit to JoshuaKGoldberg/create-typescript-app that referenced this pull request Dec 2, 2025
## PR Checklist

- [x] Addresses an existing open issue: fixes #2287
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

Bumps everything to latest using `ncu -u`, except:
* `zod` and `zod-package-json`: because Bingo is still on v3
* `eslint-plugin-package-json`: pending the refresh of ESLint settings
in #2275, only bumps a few minors

The main changes are:

* Removing unnecessary `files` entries in `package.json`, courtesy of
`eslint-plugin-package-json` & `package-json-validator` updates:
JoshuaKGoldberg/eslint-plugin-package-json#1232
& co.
* Explicitly defaulting `fixedExtension` to `false`, courtesy of
rolldown/tsdown#517

🎁
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.

8 participants