question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compiled version uses ES6 syntax (=>)

See original GitHub issue

Thanks for a nice lib!

Seems like the babel transpilation step is not working correctly, should there really be “=>” in the output file?

./mixwith.js:

const Cached = exports.Cached = mixin => wrap(mixin, superclass => {

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:6
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
justinfagnanicommented, Jul 19, 2017

That’s fine I suppose, but the ES5 version won’t work with ES6 superclasses, so I don’t really see the point. ES5 can’t emulate super(), so as soon as you apply a mixin to an ES6 class, you’ll get an error.

At this point libraries, especially ones that use ES6 features, should just distribute ES6 and let applications compile down to something else if needed. All browsers and Node support ES6 now.

2reactions
justinfagnanicommented, Jan 22, 2018

Like I’ve tried to point out before, a compiled version of this library simply does not work with classes. I really don’t think it’s work distributing a broken version of the library.

I’m not in any way suggesting that IE11 support isn’t important, but figuring out what language features need to be compiled out is really the job of the application that knows what language features are supported by target platforms. Running dependencies through babel-preset-env is a great way for an app to only compile out what’s necessary, and it ensures that if you’re compiling out classes in mixwith, you’re also compiling out classes anywhere it might be applied, so that the whole app continues to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ES6 Syntax, Features and Additions: A Reference Guide
Learn about the new ES6 features, enhancements, and shortcuts introduced to the JavaScript programming language.
Read more >
Are ES6 features compiled to ES5 when used within TypeScript?
I disagree with the Fylax's answer. The TypeScript compiler doesn't require an additional tool for converting the ES6 syntax to ES 3 or...
Read more >
How to enable ES6 (and beyond) syntax with Node and Express
Before we begin, we need some things setup first. Make sure you have Node.js and npm installed. I recommend installing their latest LTS...
Read more >
ECMAScript 6 Features - GitHub Pages
The easiest way to do that is to use the Babel compiler, which can translate all of the new ES6 syntax and features...
Read more >
ES6 syntax fails to compile even on a clean new app ... - GitHub
To use ES6 syntax, harmony mode must be enabled with ... `compile' /Users/joelsouza/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/sprockets ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found