redsift / sandbox-javascript

DAG Container for NodeJS
1 stars 0 forks source link

Added support for ES module nodes #63

Closed Caluminus closed 1 year ago

Caluminus commented 1 year ago

View this PR with "Hide whitespace"

The JS sandbox first tries to import the node file using ES module syntax (await import(...)), and falls back to CommonJS require syntax if that fails.

Allows node functions to be exported using export default ... as well as module.exports = ..., and should hopefully allow us to convert whole sift backends to ES modules.

I don't know exactly how the SDK works when running without docker, but since the file I changed in the SDK (when running without docker) is an exact match for this file, I assume changing it here will also affect running JS nodes locally without docker.