egoist / egoist/tsup

About __toESM How can I fix it other than downgrade

Open
#596 4 comments 0 reactions 0 assignees View on GitHub
need repro
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

When I installed `tsup@^5.6.0` and compiler format set `cjs`. my compiled file content is like:

```javascript
var example = __toModule(require('example'))

example.abc()
```

but now, I used `tsup@^5.11.12` and same compiler format. my compiled file content is like:

```javascript
var example = __toESM(require('example'))

example.default.abc()
```

now, run this file will thorw error like: `TypeError: Cannot read property 'abc' of undefined`.

I saw https://github.com/evanw/esbuild/issues/1897 this link and I fined esbuild version difference.

so, I downgrade to `tsup@^5.6.0` fix this probrom. and what other solution can fix this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.