How to use the es6.spec.templateLiterals transformer.
This transformer wraps all template literal expressions with String
. See Issue #1065 for more info.
require("babel").transform("code", { optional: ["es6.spec.templateLiterals"] });
$ babel --optional es6.spec.templateLiterals script.js
In
`foo${bar}`;
Out
"foo" + String(bar);