Forum

Using ecma6

10 June 2017 22:28
When I try to compile ecma6 code I get:

Use –language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT or higher to enable ES6 features.


However I do not know where can I use this, project.py does not accept this cli switch.
11 June 2017 12:33
Ok I found it. It turned out that blend4web uses the Google Closure Compiler, and the
–language_in
parameter hardcoded in scripts/lib/project_cli.py

— a/scripts/lib/project_cli.py
+++ b/scripts/lib/project_cli.py
@@ -348,7 +348,7 @@ def fill_global_paths(base_dir):

# closure compiler params
_js_cc_params = [_java_exec, "-jar", js_cc_path,
- "–language_in=ECMASCRIPT5"]
+ "–language_in=ECMASCRIPT6"]

# engine sources directory
_src_dir = join(base_dir, "src")


However I guess it is not wise to change this parameter, because all of the b4w modules are written in es5. So It can effect their optimization badly. So I will transpile my code to es5.
 
Please register or log in to leave a reply.