execute-esm-export
Execute an ESM export
Node.js version support
This module officially requires node.js 13.3.0 or above. It may be possible to use with
older versions of node.js but --experimental-modules
would need to be set. Issues will
only be fixed if present in versions of node.js where ES modules are unflagged.
Writing callable exports
// exports.mjs { console;} { console; throw 'This async (Promise) rejection will be caught and reported';} { console;}
Executing
The arguments pattern is execute-esm-export [exportName [...args]]
. If [...args]
are being provided then the exportName
must also be provided.
npx execute-esm-export exports.mjs# -> default function called with args: [] npx execute-esm-export exports.mjs default arg1 arg2# -> default function called with args: [ 'arg1', 'arg2' ] npx execute-esm-export exports.mjs named arg1 arg2# -> named function called with args: [ 'arg1', 'arg2' ]