frenchie
frenchie

Reputation: 51947

ES6 not supported in Closure Compiler

I'm using Google Closure Compiler and I'm getting the following error:

ES6_FEATURE: this language feature is only supported in es6 mode: computed property. Use --language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT to enable ES6 features.

The line that triggers this error is this one:

var TheCellRef = LeadImport2ExcelLibrary['utils']['encode_cell']({ ['c']: C, ['r']: R });

Basically I'm passing an object that I'm creating on the same line. I know I could simply add the support for ES6 in the JavaScript source header but I was wondering why this error is coming up and how to fix it?

Upvotes: 3

Views: 2483

Answers (1)

mati
mati

Reputation: 5348

It's because you are using Computed Property Names in the literal object:

{ ['c']: C, ['r']: R }

An es5 compatible replacement might be:

var TheCellRef = LeadImport2ExcelLibrary['utils']['encode_cell']({ "c": C, "r": R });

Upvotes: 5

Related Questions