davidbanham / express-async-errors

async/await support for ExpressJS
Other
900 stars 43 forks source link

Does this support ES6 Imports? #14

Closed marbuser closed 5 years ago

marbuser commented 5 years ago

Hey there,

So I was just wondering if this package still works with ES6 Imports and Babel. I mainly ask due to hoisting and I'm unsure if that will break it.

I also ask because it feels very unstable in my projects. Sometimes it works, other times it doesn't. Or to be honest, I'm not even entirely sure if it works at all. It's hard to tell.

Is there a basic example that will cause this package to activate that I can use to see if it works with ES6?

Thanks

davidbanham commented 5 years ago

Hi marbuser, I don't use ES6 imports or Babel transpilation in my server-side code so I can't give you a definitive answer. If you've already got an ES6 pipeline set up it should be pretty straightforward to lay out a minimal Express app using imports and this plugin and see what happens.

I've never experienced the kind of instability you describe in any of the production apps I've used this in. If you can narrow down what's happening and it turns out to be a bug in the library and not downstream code I'd love to know about it so we can fix it.

MrWook commented 5 years ago

I can confirm that it will work with ES6 import and babel. Just added import 'express-async-errors' inside my main index.js file and it works perfectly in production and development mode.