babel-plugin-version-transform

1.0.0 • Public • Published

babel-plugin-version-transform

Replaces keyword VERSION with a stringified copy of the package.json version number.

Example

In

version: "1.0.0"
function log(data) {
  xhr({...data, version: VERSION});
}

Out

version: "1.0.0"
function log(data) {
  xhr({...data, version: "1.0.0"});
}

Installation

$ npm install babel-plugin-transform-define

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [
    "version-transform"
  ]
}

Via CLI

$ babel --plugins version-transform script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["version-transform"],
});

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-version-transform

Weekly Downloads

48

Version

1.0.0

License

MIT

Last publish

Collaborators

  • blainekasten