JSPM

babel-plugin-transform-replace-expressions

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 105070
  • Score
    100M100P100Q178383F
  • License MIT

Replace JavaScript expressions with other expressions

Package Exports

  • babel-plugin-transform-replace-expressions

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-transform-replace-expressions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-transform-replace-expressions

Replace JavaScript expressions with other expressions.

Installation

$ yarn add --dev babel-plugin-transform-replace-expressions

Example

Input file:

const env = process.env.NODE_ENV;

typeof Hello === "number";

.babelrc:

{
  "plugins": [
    [
      "babel-plugin-transform-replace-expressions",
      {
        "process.env.NODE_ENV": "\"production\"",
        "typeof Hello": "42"
      }
    ]
  ]
}

Output:

const env = "production";

42 === "number";

License

This plugin is licensed under the MIT license. See LICENSE.