Skip to content

Es6 default import support #2677

Closed
Closed
@bobzhang

Description

@bobzhang

It seems we already support export default.

export {
   $$default,
   $$default as default
}

See http://exploringjs.com/es6/ch_modules.html

const __default__ = «expression»;
export { __default__ as default }; 

That's what we did for default export

For default import,

external myFunction : unit -> unit = "my-module" [@@bs.default]
let () = myFunction ()

Expect generated ES6 code:

import myFunction from "my-module"
myFunction()

For commonjs

var myModule = require("my-module")
myModule.default ()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions