Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add es6 module #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kristinn93
Copy link
Contributor

Currently I'm maintaining my own fork of these bindings since I use es6 in all of my projects.

// bsconfig.json
...
  "package-specs": {
    "module": "es6",
    "in-source": true
  },
...

A lot of the changes are refmt changes, but in line 312 I added a ES6 module.
This is backwards compatible and won't affect anyone.

This allows people who have es6 setup to instantiate a Moment object like this:

MomentRe.ES6.momentNow()

because

MomentRe.momentNow()

crashes my bundler

@TravisBuddy
Copy link

Hey @kristinn93,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 07013380-65c6-11e9-aafa-87f824428b00

@mlms13
Copy link

mlms13 commented Apr 23, 2019

This probably affects (and hopefully resolves?) #31.

@kristinn93
Copy link
Contributor Author

kristinn93 commented Apr 24, 2019

@mlms13 Yes this will solve that. I had the same issue.

By doing this

Js.log2("moment", MomentRe.momentNow());

The following code is generated:

import * as Moment from "moment";
console.log("moment", Moment());

@kristinn93
Copy link
Contributor Author

Also if you were wondering it's not possible to use the ES6 module with a commonjs project.
I setup a small commonjs project and by using the ES6 module I got moment.default is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants