egoist / egoist/tsup

Modify import paths when transpiling to CJS

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

Description

I'ld like to use `tsup` to transpile the [WebdriverIO project](https://github.com/webdriverio/webdriverio) into ESM and CJS exports. I see the following issue: given I a module with the following import:

```js
import moduleA from './moduleA.js'
```
Now when I transpile the code into `file.js` (ESM) and `file.cjs` (CJS) the `file.cjs` will have the following transpiled code:

```js
var import_moduleA = require("./moduleA.js");
```
which points to the ESM version.

What is the recommended way to setup tsup to allow both exports? Note that bundling into a single file is not an option.

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.