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

Support .mjs as file extension for es modules #60

Closed
wants to merge 1 commit into from

Conversation

mweststrate
Copy link

Summary

Support .mjs as file extension for es modules assuming they have been transpiled properly that is, like webpack does.

Example setup: https://github.com/mobxjs/mobx/pull/1131/files

Should solve #59

Beyond that I

Test plan

I have no clue what I am doing, nor do I have any experience with RN so this is just a proposal 😁

Testing can be done by dropping the following to files in <modules folder>/mjstest

package.json

{
   "version": "1.0.0",
   "name": "mjstest"
   "module": "index.mjs"
}

index.mjs

function log() {
  console.log("hello from .mjs")
}

export { log }

and than in an app use it:

import { log } from "mjstest"

log() // should log something

I realize this is the most pathetic attempt of a PR ever. So feel free to close it, but I hope it might have some use as a starting point for support the .mjs extension :)

...assuming they have been transpiled properly that is, like webpack does.

Example setup: https://github.com/mobxjs/mobx/pull/1131/files

Should solve facebook#59

Beyond that I have no clue what I am doing, so this is just a proposal 😁
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 18, 2017
@mweststrate
Copy link
Author

Closing for now, until .mjs has become a bit more mainstream. For further discussion see #59

@bkaney
Copy link

bkaney commented Jun 27, 2019

Looking that this 2 years later, perhaps it makes sense to support .mjs now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants