@babel/plugin-proposal-json-strings

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

Examples

In

  1. const ex = "before
  2. after";
  3. // ^ There's a U+2028 char between 'before' and 'after'

Out

  1. const ex = "before\u2028after";
  2. // ^ There's a U+2028 char between 'before' and 'after'

Installation

  1. npm install --save-dev @babel/plugin-proposal-json-strings

Usage

  1. {
  2. "plugins": ["@babel/plugin-proposal-json-strings"]
  3. }

Via CLI

  1. babel --plugins @babel/plugin-proposal-json-strings script.js

Via Node API

  1. require("@babel/core").transformSync("code", {
  2. plugins: ["@babel/plugin-proposal-json-strings"],
  3. });

References