Compiled version uses ES6 syntax (=>)
See original GitHub issueThanks 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:
- Created 7 years ago
- Reactions:6
- Comments:21 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.