Repository navigation
Description
Clear and concise description of the problem
When I attempt to run tsdown in a project with tsdown.config.ts using Node.js v24.21.0 installed from the nodejs Debian package it reports Error: Failed to import module "unrun".
Initially I believed the problem was in the package I was attempting to build. Later I determined it was in tsdown. Even later I determined it was due to how tsdown handles the lack of TypeScript support in Node.js. (See Debian Bug 1151683 for why it's missing in Debian.)
Reproduction:
$ npm init -y
$ npm i -D tsdown
$ touch tsdown.config.ts
$ ./node_modules/.bin/tsdown
ℹ tsdown v0.23.7 powered by rolldown v1.3.1
ERROR Error: Failed to import module "unrun". Please ensure it is installed.
at importWithError (file:///path/to/node_modules/tsdown/dist/style-BMCJFWa9.mjs:45:9)
at async unrunImport (file:///path/to/node_modules/tsdown/dist/options-C2rtkmcY.mjs:600:20)
at async iterateAsync (file:///path/to/node_modules/quansync/dist/src-C2Pm6gXo.js:58:28)
at async iterateAsync (file:///path/to/node_modules/quansync/dist/src-C2Pm6gXo.js:58:28)
at async iterateAsync (file:///path/to/node_modules/quansync/dist/src-C2Pm6gXo.js:58:28)
at async loadConfigFile (file:///path/to/node_modules/tsdown/dist/options-C2rtkmcY.mjs:511:19)
at async resolveConfig (file:///path/to/node_modules/tsdown/dist/build-S0sSJY-K.mjs:96:51)
at async build$1 (file:///path/to/node_modules/tsdown/dist/build-S0sSJY-K.mjs:721:28)
at async CAC.<anonymous> (file:///path/to/node_modules/tsdown/dist/run.mjs:21:2)
at async runCLI (file:///path/to/node_modules/tsdown/dist/run.mjs:81:3)
Suggested solution
Perhaps it would be possible to catch the import error in unrunImport and throw an error with a more informative message, such as "unrun package must be installed when TypeScript support is not available in Node.js".
Alternative
If runtimes without TypeScript support are unsupported, print an error message informing the user that the platform is unsupported.
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Start date
Target date
Effort
Activity
kevinoid commentedon Nov 10, 2026
Thanks @lazerg and @sxzz, #1129 looks perfect. I really appreciate it!