my project use "ts-node",
now, when i import 'ora' ,it tell me "ES Module not supported",
so,i add type:module to package and change module:ESNEXT to tsconfig.json ,then run node --loader ts-node/esm --experimental-specifier-resolution=node src\*.ts, it's work ok !
but when i convert code to "cjs",and run it with node, it tell me "ES Module not supported", i don't think so it.
why not add export like this?
the code from ava's 'package.json'
"exports": {
".": {
"import": "./entrypoints/main.mjs", // this is ES Module,when my project is ESModule, it's auto import
"require": "./entrypoints/main.cjs" // this is Commonjs , when my project is Commonjs, it's auto import
},
},
"type": "module",
question
my project use "ts-node", now, when i import 'ora' ,it tell me "ES Module not supported", so,i add
type:module
topackage
and changemodule:ESNEXT
totsconfig.json
,then runnode --loader ts-node/esm --experimental-specifier-resolution=node src\*.ts
, it's work ok ! but when i convert code to "cjs",and run it with node, it tell me "ES Module not supported", i don't think so it.why not add export like this?
the code from ava's 'package.json'
another way
ora@5.x is commonjs