egoist / egoist/tsup

ESM output with CJS content

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

Description

I am pretty happy using `tsup` for a couple of packages inside a [monorepo](https://github.com/elrumordelaluz/reactour) (using `turbo`), but having several problems with a [particular one](https://github.com/elrumordelaluz/reactour/tree/7b1497b98a629ef22dd31e4f6404a4fe9db99a00/packages/utils), which fires the error described at #579, in my case, the message is:

> Error: Dynamic require of "react" is not supported

Screenshot 2022-08-27 at 17 55 13

The `dev` and `build` [scripts](https://github.com/elrumordelaluz/reactour/blob/7b1497b98a629ef22dd31e4f6404a4fe9db99a00/packages/utils/package.json#L21-L22) are the same for all packages, however I am noticing that for this particular one, the `.mjs` and `.js` output is pretty similar. I mean that the `mjs` file has the appearance to be transpiled into cjs, like in the screenshot below, when in the other packages, the same file maintains the `import` statements and modern structure like the input file.

Screenshot 2022-08-27 at 18 01 22

Thanks in advance!

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.