How to disable Babel Unicode compilation?

280 views Asked by At

If you have an input code like:

var x = "\u0000";

it will be converted to

"use strict";

var x = "\0";

You can test this on the Babel website itself: Example

What is necessary to disable Unicode compilation?

(Tested with Babel 6.19.0)

1

There are 1 answers

7
Dekel On

"\u0000" Is a specific example, it will not happen with other unicode chars.

If you try it with \u0200 for example - it will not change.

You can see in the following example that the actual value is exactly the same:

console.log('\u0000' === '\0')