Skip to content

Added es6 export default function module support. #621

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

Merged
merged 6 commits into from
Sep 8, 2016

Conversation

dbillingham
Copy link
Contributor

Within my required files before running cucumber I have to export using the commonjs syntax:

module.exports = function() {
  this.World = World;
};

I would like to export these using the es6 module syntax:

export default function() {
  this.World = World;
}

Babel 6 now correctly transpiles this to not include:

module.exports = exports["default"];

I would like to be able to require es6 modules without the need of a babel plugin to incorrectly add the module.exports to the bottom of the transpiled file.

This pr contains some code for discussion to achieve this.

initializer.call(supportCodeHelper);
} else if (initializer.hasOwnProperty('default')) {
if (typeof(initializer.default) === 'function') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we join the two conditions?

else if (initializer.hasOwnProperty('default') && typeof(initializer.default) === 'function') {
  initializer.default.call(supportCodeHelper);
}

@charlierudolph
Copy link
Member

Sorry for the delay. Just the one comment and then looks good to me

@charlierudolph
Copy link
Member

@dbillingham bump

@dbillingham
Copy link
Contributor Author

Thanks @charlierudolph, pr has been updated.

@charlierudolph charlierudolph merged commit 78fd15e into cucumber:master Sep 8, 2016
@charlierudolph
Copy link
Member

Thanks for the contribution! I should be releasing a new version this weekend that will include this

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants