rado
rado

Reputation: 1

Closure Compiler, how to stop converting arrow functions to regular functions

let test = () => { return true; }

becomes

var test=function(){return!0};

but I want to keep the arrow function (checking for ES6 support). How can I do this?

Upvotes: 0

Views: 363

Answers (1)

Chad Killingsworth
Chad Killingsworth

Reputation: 14411

Transpilation is controlled by the language flags. You'll need --language_out=ECMASCRIPT_2015 (or higher) to keep arrow functions as that is the first Ecmascript version that supports arrow functions.

Upvotes: 2

Related Questions