Skip to content

[Feature] ESM support #579

@estacioneto

Description

@estacioneto

Hello!

Kulala works amazingly for my needs but some devs on our team work with httpYac on VSCode. One big difference is that this works fine on kulala:

async function main() {
  request.variables.set('computed_request_body', await heavyComputationOrFetch())
}

main()

...while on httpYac we would need a top-level await, meaning:

async function main() {
  request.variables.set('computed_request_body', await heavyComputationOrFetch())
}

await main()

Node.js already supports top-level awaits, but AFAIK they are available only for ES Modules (.mjs), while I believe Kulala creates a CommonJS (.js) file for running the script.

Possible solution

  • Allow .mjs scripts, which can be identified by their file extension

Additional info

Here's a related issue for plugin compatibility, but I believe that supporting ESM here would be a win even if the import is not supported by httpYac.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions