Expected Behavior
The following should work without any errors:
Actual Behavior
Triggers the following error:
The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("zx")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `"type": "module"` to 'package.json'.ts(1479)
However, the project works just fine. This is because main in package.json is set to a CJS entry-point (thank you!)
The only alternative I am aware of is setting {type: module} inside esm build directory. It would be great if zx could be used in both ESM and CJS projects without warnings.
Expected Behavior
The following should work without any errors:
Actual Behavior
Triggers the following error:
However, the project works just fine. This is because
maininpackage.jsonis set to a CJS entry-point (thank you!)The only alternative I am aware of is setting
{type: module}insideesmbuild directory. It would be great ifzxcould be used in both ESM and CJS projects without warnings.