Skip to main content

@babel/plugin-transform-unicode-escapes

NOTE: This plugin is included in @babel/preset-env

Compile ES2015 Unicode escapes to ES5

Example

In

JavaScript
var \u{1d49c} = "\u{Babe1}";

console.log(\u{1d49c});

Out

JavaScript
var _ud835_udc9c = "\uDAAA\uDFE1";

console.log(_ud835_udc9c);

Installation

npm install --save-dev @babel/plugin-transform-unicode-escapes

Usage

babel.config.json
{
"plugins": ["@babel/plugin-transform-unicode-escapes"]
}

Via CLI

Shell
babel --plugins @babel/plugin-transform-unicode-escapes

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-transform-unicode-escapes"],
});