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
When using typescript with
"module": "commonjs"intsconfig.json, mixing ESM/CJS fails with the following error:This does not match the behavior of
tscwhich allows mixed usage.https://github.com/uncurated-tests/ncc-ts-mixed-modules