I'm seeing build errors related to .ts files that contain #!/usr/bin/env node
, which tsup tries to chmod +x in order to ensure they are executable:
⋮
ESM dist/integrations/webpack-plugin.mjs 2.93 KB
ESM dist/imperativeAPI/useIntl.mjs 428.00 B
ESM dist/compiledLocales/es.mjs 4.58 KB
ESM dist/compiledLocales/sr.mjs 7.41 KB
ESM dist/types/index.mjs 156.00 B
ESM dist/compiledLocales/et.mjs 4.54 KB
ESM ⚡️ Build success in 140ms
DTS Build start
Error: ENOENT: no such file or directory, chmod '/Users/kyank/Developer/unified-home/packages/i18n-react-intl/dist/scripts/extract.d.mts'
Error: error occured in dts build
at Worker.<anonymous> (/Users/kyank/Developer/unified-home/node_modules/tsup/dist/index.js:2294:26)
at Worker.emit (node:events:513:28)
at MessagePort.<anonymous> (node:internal/worker:243:53)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:737:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
DTS Build error
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If I re-run the build without deleting the dist directory first, the error does not re-occur. If I remove the scripts/extract.ts
entry module from my project, the same error occurs with a different script:
⋮
ESM dist/integrations/webpack-plugin.mjs 2.93 KB
ESM dist/compiledLocales/lv.mjs 6.08 KB
ESM dist/imperativeAPI/formatDate.mjs 166.00 B
ESM dist/compiledLocales/et.mjs 4.54 KB
ESM dist/compiledLocales/tl.mjs 4.53 KB
ESM dist/integrations/webpack.mjs 328.00 B
ESM ⚡️ Build success in 172ms
DTS Build start
Error: ENOENT: no such file or directory, chmod '/Users/kyank/Developer/unified-home/packages/i18n-react-intl/dist/scripts/smartlingPush.d.mts'
Error: error occured in dts build
at Worker.<anonymous> (/Users/kyank/Developer/unified-home/node_modules/tsup/dist/index.js:2294:26)
at Worker.emit (node:events:513:28)
at MessagePort.<anonymous> (node:internal/worker:243:53)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:737:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
DTS Build error
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I've tried and failed to reproduce this in a toy project, where I guess the generation of .d.(m)ts files runs much more quickly, and therefore all of those files are generated before tsup tries to chmod those with shebangs at the top.
Unless I'm mistaken, the .d.(m)ts files for shebang scripts don't actually need to be chmod +x; only the actual .(m)js files need to be made executable. Could this be fixed by excluding the type definition files from the shebang plug-in?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too