datalust/bunyan-seq

ES5 build

Closed this issue · 5 comments

Hi,

Is there any chance to have the published packages be in ES5 instead of ES6?

The reason being that UglifyJs doesn't support ES6 yet, and being in a TS project we find bringing in Babel just to compile a dependency a bit too much.

Thanks

Hi @luanped!

I believe that as of TypeScript 1.8, ES6 inputs can be included and transpiled by passing them to the compiler and specifying the --allowjs option.

https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#including-js-files-with---allowjs

(There's a tsconfig equivalent syntax as well I think.)

Would this work for you?

Regards,
Nick

Hi @nick!

Tried this method, unfortunately it doesn't fully work - it works when bundling, however it fails with some errors when I run Mocha tests (error does not occur if I manually convert the bunyan-seq code to ES5 first however)

Thanks,
Pedro

Thank you Pedro.

It sounds like Mocha can accept a --compilers option to ease this up; do you test in TypeScript or ES
5? It may be a bit much plumbing to deal with either way....

Which version of Node are you developing/deploying on?

Also, may be an odd question, but are you using Uglify because you're sharing code with the browser, or is the space win enough to justify it on your server-side code?

Thanks again for the info, keen to remove as many blockers for you as I can here, just trying to build a clearer picture for myself of how the landscape lies :-)

Cheers,
Nick

Hi Nick,

Thanks for your suggestions, I was able to solve my problems by using --allowJs and tsloader with the include property on bunyan-seq and seq-stream :)

Regards,
Pedro

That's awesome, thank you for the follow-up Pedro!