Skip to content

Support ES6 modules #175

Open
Open
@caseyjhol

Description

@caseyjhol

Describe your feature request here.

Are there any plans to support ES6 modules in addition to CommonJS?

Example JS:

function hello(items) {
    console.log("hello world");
}

export {hello};

Trying to use this with PythonMonkey currently throws an error:

    return createRequire(filename)(moduleIdentifier)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pythonmonkey.SpiderMonkeyError: Error in file [python code], on line 0:
Error: Python str: Error in file evaluate, on line 5:
export default hello;
^
SyntaxError: export declarations may only appear at top level of a module

Code example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions