MarkLogic v10 introduced the support for native JavaScript Module (ECMAScript module).
https://docs.marklogic.com/guide/jsref/modules
However I am not sure how to import such modules in resource extensions. For example:
'use strict';
import * as jsearch = from '/MarkLogic/jsearch.mjs';
function get(context, params) {
// omitted
};
exports.GET = get;
would lead to the following error:
JS-JAVASCRIPT: import * as jsearch = from '/MarkLogic/jsearch.mjs'; -- Error running JavaScript request: SyntaxError: Unexpected token *;
Similarly, importing a custom module such as import { foo } from '/bar.mjs' results in a similar error: Unexpected token {.
Thank you!