@babel/plugin-proposal-unicode-property-regex
NOTE: This plugin is included in
@babel/preset-env
, in ES2018
Installation
- npm
- Yarn
npm install --save-dev @babel/plugin-proposal-unicode-property-regex
yarn add --dev @babel/plugin-proposal-unicode-property-regex
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-proposal-unicode-property-regex"]
}
Via CLI
Shell
babel --plugins @babel/@babel/plugin-proposal-unicode-property-regex script.js
Via Node.js API
JavaScript
require("@babel/core").transformSync(code, {
plugins: ["@babel/plugin-proposal-unicode-property-regex"],
});
To transpile to ES6/ES2015:
JavaScript
require("@babel/core").transformSync(code, {
plugins: [
[
"@babel/plugin-proposal-unicode-property-regex",
{ useUnicodeFlag: false },
],
],
});
Options
useUnicodeFlag
(defaults totrue
)
When disabled with false
, the transform converts Unicode regexes to
non-Unicode regexes for wider support, removing the u
flag. See https://github.com/mathiasbynens/regexpu-core#useunicodeflag-default-false for more information.
You can read more about configuring plugin options here
Author
Mathias Bynens |