babel-plugin-define-patterns
v1.0.0
Published
Create constants that replace various expressions at build-time
Downloads
5,136
Readme
babel-plugin-define-patterns
Create constants that replace various expressions at build-time
Install
npm install --save-dev babel-plugin-define-patterns
Usage
// babel.config.json
{
"plugins": [
["define-patterns", {
"replacements": {
"process.env.NODE_ENV": "production",
"typeof window": "object",
"__DEV__": true,
"require('currentBuildNumber')": 42
}
}]
]
}
Example
Input:
process.env.NODE_ENV
Options:
{
"replacements": {
"process.env.NODE_ENV": "development"
}
}
Output:
"development"
For more examples see input.txt and output.txt.