hapijs / glue

Server composer for hapi.js
Other
245 stars 62 forks source link

Adding support for ES2015 Babel transpiled modules #70

Closed rafakato closed 8 years ago

rafakato commented 8 years ago

When Babel transpile export default it adds a __esModule property to the module when requiring it in the code. So this change is to check this property and then loads the register from default property created by Babel

csrl commented 8 years ago

What's the motivation here?

rafakato commented 8 years ago

When I write a plugin inside the project using ES2015 module pattern, glue gives an error when I try to register it, because when transpiled, the ES2015 module export default became a property default when required using require. So this check is to avoid this kind of problem

csrl commented 8 years ago

It is a rather trivial change, but given the sentiment elsewhere in the hapi core to not add shims like this, I'm hesitant. Can you raise this question in hapijs/discuss and reference this issue?

rafakato commented 8 years ago

Oh, I didn't knew about this statement in hapi core. I'll open an issue there to discuss this. Thanks!

csrl commented 8 years ago

Did you open a discussion elsewhere?

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.