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 support for "default" export behavior in ECMAScript Modules #60

Closed
nurdism opened this issue Feb 1, 2019 · 2 comments
Closed

Add support for "default" export behavior in ECMAScript Modules #60

nurdism opened this issue Feb 1, 2019 · 2 comments

Comments

@nurdism
Copy link
Contributor

nurdism commented Feb 1, 2019

Using babble to write my plugins, running into an issue with export default foo. Simple fix/solution would be to add :

  if (typeof fn.default !== "undefined" ) {
    fn = fn.default
  }

before https://github.com/fastify/fastify-plugin/blob/master/index.js#L8

@mcollina
Copy link
Member

mcollina commented Feb 1, 2019

Would you like to send a PR to add this?
Would this just support transpiled modules, or actual node syntax with .mjs?

@nurdism
Copy link
Contributor Author

nurdism commented Feb 1, 2019

this is just for transpiled modules from babel, and yeah I can make a quick PR for it

mcollina pushed a commit that referenced this issue Feb 6, 2019
* fn.default check for transpiled modules

More info in issue #60

* lint fix (oops)

* Unit test for ECMAScript module

* Apply suggestions from code review

Co-Authored-By: nurdism <craigbett@gmail.com>

* Apply suggestions from @delvedor

* Apply suggestions from @Ethan-Arrowood
@nurdism nurdism closed this as completed Feb 6, 2019
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

No branches or pull requests

2 participants