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

- Initially suport es6 native modules #101

Merged
merged 1 commit into from
Nov 2, 2017

Conversation

vpotseluyko
Copy link
Contributor

@vpotseluyko vpotseluyko commented Oct 29, 2017

From node v8.8.1 we received unstable es6 modules support with flag --experimental-modules.
(more about it here: https://nodejs.org/api/esm.html)

Es6 modules has broken code which depends on commonJS module system. This pull request allows initially with some hacks support es6 modules.

Note: this provides full backward compatibility with CommonJS project.
Note: I'd hope this will be included in next pmx release - while es6 modules are still experimental feature they are worse supporting right now.
I was not really sure where and how shall I pull request it. Hope dev branch was the right choice.
I created simple project for demonstrating es6 modules usage: https://github.com/vpotseluyko/test-es6-pm2

@CLAassistant
Copy link

CLAassistant commented Oct 29, 2017

CLA assistant check
All committers have signed the CLA.

@vpotseluyko
Copy link
Contributor Author

Travis CI tests failed on Node 4. It looks like that tests failed for reasons that I didn't really touch

@vpotseluyko
Copy link
Contributor Author

vpotseluyko commented Oct 29, 2017

Cause it's not too obvious from PR desription I'd rather explain one more time:
In es6 modules enviroment were deprecated:

  1. module variable
  2. __dirname && __filename variables
  3. require variable
    It's not bugs, it's expected behaviour, and it will be so up to release stable versions. Meanwhile we can start preparing our projects for esm right now.
    Pmx is part of world popular app launcher, and I hope that u can provide initial es6 support as fast, as possible.
    My code provides a couple of hacks based on relative pathes and standart values. I didn't write programmatic tests for them, cause I have no time, but they work - and u can test it.
    As u can see my code is applied only if module || require vars are undefined, that's why it's fully backward compatible. Moreover, it doesn't change pmx api at all
    Of course, full esm support must be made more carefully - but I really hope that some small workaround mentioned as possibly unstable and experimental could be provided right now.

@vmarchaud
Copy link
Contributor

We will look into this in the week, no worries we will try to make a patch as fast as possible

@Unitech
Copy link
Member

Unitech commented Nov 2, 2017

Awesome, thanks a bunch @vpotseluyko for the PR and test project, digging in right now

@Unitech Unitech merged commit 9f3c9d0 into keymetrics:development Nov 2, 2017
@SteveCruise
Copy link

SteveCruise commented Nov 8, 2017

mark, wait for fix

@johnwebbcole
Copy link

Any idea for a release date on this?

@vpotseluyko
Copy link
Contributor Author

+1

1 similar comment
@neyasov
Copy link

neyasov commented Nov 10, 2017

+1

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.

None yet

7 participants