privatenumber / tsx

⚡️ TypeScript Execute | The easiest way to run TypeScript in Node.js
https://tsx.is
MIT License
9.42k stars 144 forks source link

tsx 4.13.1 fails to find exported module in @aws-sdk/client-iot-data-plane with Node.js 20 #577

Closed coderbyheart closed 3 months ago

coderbyheart commented 3 months ago

Acknowledgements

Minimal reproduction URL

https://github.com/coderbyheart/tsx-import-bug/actions/runs/9414431871/job/25933332684#step:5:6

Problem & expected behavior (under 200 words)

This works with 4.12.1: https://github.com/coderbyheart/tsx-import-bug/actions/runs/9414522107/job/25933611074#step:6:5

package.json

{
  "devDependencies": {
    "@aws-sdk/client-iot-data-plane": "3.592.0",
    "tsx": "4.13.1"
  },
  "engines": { "node": ">=20" }
}

index.ts

import { UpdateThingShadowCommand } from '@aws-sdk/client-iot-data-plane';

new UpdateThingShadowCommand({} as any);

Output

$ npx tsx -v
tsx v4.13.1
node v20.14.0

$ npx tsx index.ts

import { UpdateThingShadowCommand } from "@aws-sdk/client-iot-data-plane";
^

SyntaxError: The requested module '@aws-sdk/client-iot-data-plane' does not provide an export named 'UpdateThingShadowCommand'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

Node.js v20.14.0

Bugs are expected to be fixed by those affected by it

Compensating engineering work financially will speed up resolution

m4rvr commented 3 months ago

I have the same issue with the envalid npm package (https://www.npmjs.com/package/envalid). It works with 4.13.0.

AliMirlou commented 3 months ago

I'm facing the same issue on most installed packages.

This commit has caused the issue: https://github.com/privatenumber/tsx/commit/0a78bfd11b20fcb6460fdcdea7d3b1daebfe3ad0

karlhorky commented 3 months ago

I created further CodeSandbox reproductions in my issue also about The requested module '...' does not provide an export named '...', reported over here:

privatenumber commented 3 months ago

I've hidden comments that aren't constructive towards fixing the issue.

If you have a similar bug, consider filing a separate issue with your own minimal reproduction. Often times, we'll address the reported issue and reports in the comments get neglected.

Please read the Contribution Guide for guidelines on commenting on Issues.

privatenumber commented 3 months ago

:tada: This issue has been resolved in v4.13.2

If you appreciate this project, please consider supporting this project by sponsoring :heart: :pray:

privatenumber commented 3 months ago

Thanks for the issue @coderbyheart! Should be fixed now ^