2.0.1 • Published 3 years ago

babel-plugin-vanilla-shake v2.0.1

Weekly downloads
48
License
BSD-3-Clause
Repository
github
Last release
3 years ago

vanilla-shake

Build status

vanilla conditional compile plugin for babel.

consider this:

const foo = 1;
const bar = 2;
if (SHOULD_KEEP) {
  console.log(foo);
} else if (SHOULD_KEEP_2) {
  console.log(bar);
} else {
  console.log("hej")
}

configure the plugin like this:

{
  plugins: [["vanilla-shake", {
    defined: {
      SHOULD_KEEP: false,
      SHOULD_KEEP_2: true
    }
  }]]
}

after code is transpiled with the configured plugin:

const foo = 1;
const bar = 2;

console.log(bar);