Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax #765

Closed
styfle opened this issue Sep 9, 2021 · 0 comments · Fixed by #766
Closed
Labels
bug Something isn't working

Comments

@styfle
Copy link
Member

styfle commented Sep 9, 2021

When using typescript with "module": "commonjs" in tsconfig.json, mixing ESM/CJS fails with the following error:

Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax

This does not match the behavior of tsc which allows mixed usage.

git clone https://github.com/uncurated-tests/ncc-ts-mixed-modules
cd ncc-ts-mixed-modules
yarn install

yarn run tsc
node dist/index.js # works

rm -rf dist

ncc build index.ts
node dist/index.js # fails

https://github.com/uncurated-tests/ncc-ts-mixed-modules

@styfle styfle added the bug Something isn't working label Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant