https://github.com/expressenab/babel-plugin-vanilla-shake
Vanilla conditional compile babel plugin
https://github.com/expressenab/babel-plugin-vanilla-shake
babel-plugin conditional
Last synced: 4 months ago
JSON representation
Vanilla conditional compile babel plugin
- Host: GitHub
- URL: https://github.com/expressenab/babel-plugin-vanilla-shake
- Owner: ExpressenAB
- License: bsd-3-clause
- Created: 2017-12-15T14:38:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T08:46:27.000Z (over 4 years ago)
- Last Synced: 2025-10-10T04:58:47.082Z (4 months ago)
- Topics: babel-plugin, conditional
- Language: JavaScript
- Homepage:
- Size: 94.7 KB
- Stars: 2
- Watchers: 29
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
vanilla-shake
=============
[](https://github.com/ExpressenAB/babel-plugin-vanilla-shake/actions/workflows/build.yaml)
vanilla conditional compile plugin for babel.
consider this:
```js
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:
```js
{
plugins: [["vanilla-shake", {
defined: {
SHOULD_KEEP: false,
SHOULD_KEEP_2: true
}
}]]
}
```
after code is transpiled with the configured plugin:
```js
const foo = 1;
const bar = 2;
console.log(bar);
```