Jspm does not translate code from ES6 to ES5

Running jspm bundle-sfx some/input some/output.jsdoes not translate my code from ES6 to ES5. This makes the output file unusable.

An example of the contents of the input file:

[1,2,3,4].map((i)=>i*i);
+4
source share
1 answer

As jspm author explains here :

ES6 translation occurs only for ES6 modules, not ES6 files written in CommonJS.

This means that transpilation occurs only for files using the module syntax ( import, export). This can be forced if you add "format es6";at the top of the source file like this:

"format es6";
[1,2,3,4].map((i)=>i*i);
+7
source

All Articles