When nft analyzes a file that has both a require() and an ESM export, the first call to acorn fails because of the export, so it treats the whole file as ESM, which is probably fine.
The problem is it treats the require() as an ESM import which is wrong. This will cause the resolve dependency entrypoint in the dependency to get the ESM export instead of the proper CJS export.
If the dependency is an import, add it to imports. If it's a require(), add it to deps and don't worry about whatever isESM.
When
nft
analyzes a file that has both arequire()
and an ESMexport
, the first call to acorn fails because of theexport
, so it treats the whole file as ESM, which is probably fine.The problem is it treats the
require()
as an ESM import which is wrong. This will cause the resolve dependency entrypoint in the dependency to get the ESM export instead of the proper CJS export.If the dependency is an
import
, add it toimports
. If it's arequire()
, add it todeps
and don't worry about whateverisESM
.