You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I detect whether my node.js file was called directly from console (windows and unix systems) or loaded using the ESM module import ( import {foo} from 'bar.js')
Such functionality is not exposed. For the moment you should separate your cli and library logic into separate files.
Split the getConfig code out of cli.js so this is both testable and usable from the command line
The text was updated successfully, but these errors were encountered:
Apparently the old Python-style
require.main === module
has no equivalent in ESM node modules:Split the
getConfig
code out of cli.js so this is both testable and usable from the command lineThe text was updated successfully, but these errors were encountered: