First production build - JS errors around let-statements

Game development with Board Game Arena Studio
Post Reply
User avatar
Brainchild
Posts: 71
Joined: 31 January 2014, 19:42

First production build - JS errors around let-statements

Post by Brainchild »

I'm getting this error when I try a production build for my game:

Code: Select all

missing ; before statement
On a line like this, for example:

Code: Select all

let STOCK_SELECTION_MODE_OFF = 0;
I've determined it doesn't like the let keyword. If I change it to var it compiles fine. I thought maybe production is not supporting Javascript ECMAScript 6, but I'm able to use const, which I believe was also introduced in ES6.
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: First production build - JS errors around let-statements

Post by Tisaac »

My advice : run babeljs (https://babeljs.io/) on your code and pick ECMA5 to be sure that it will pass shrinksafe (you can also download the shrinksafe version used on BGA to check before deployment).
Too bad we are not allowed to use ECMA6 with arrow-function (solved so many scoping issue)...
User avatar
JumpMaybe
Posts: 41
Joined: 20 June 2019, 14:25

Re: First production build - JS errors around let-statements

Post by JumpMaybe »

This is mentioned in the docs:
http://en.doc.boardgamearena.com/Game_i ... amename.js
Section: ShrinkSafe minimization

There it mentions ECMAScript 3 (1999) as the cut-off..

But Brainchild is right about const being introduced in ES6 so why is that working...
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: First production build - JS errors around let-statements

Post by Een »

JumpMaybe wrote: 07 July 2020, 07:52 But Brainchild is right about const being introduced in ES6 so why is that working...
As far as I know, it does'nt.
Post Reply

Return to “Developers”