babel-preset-babelbing
v1.5.3
Published
A babel preset for transforming your JavaScript for Babelbing
Downloads
12
Readme
babel-preset-babelbing
A babel preset for transforming your JavaScript for Babelbing.
Install
$ yarn add -D babel-preset-babelbing
Usage
Via .babelrc
(Recommended)
.babelrc
{
"presets": ["babelbing"]
}
Via CLI
$ babel script.js --presets babelbing
Via Node API
require('@babel/core').transform('code', {
presets: ['babelbing']
});
Targeting Environments
This module uses @babel/preset-env to target specific environments.
Please refer to @babel/preset-env#targets for a list of available options.
For a list of browsers please see browserlist.
You may override our default list of targets by providing your own targets
key.
{
"presets": [["babelbing", {
"targets": {
"chrome": 50,
"explorer": 11,
"firefox": 45
}
}]]
}
The following transpiles only for Node v6.
{
"presets": [["babelbing", {
"targets": {
"node": 6
}
}]]
}
If you wish, you can also inherit our default list of browsers and extend them using additionalTargets
.
{
"presets": [["babelbing", {
"additionalTargets": {
"chrome": 42,
"explorer": 8
}
}]]
}
You may override our default debug option by providing your own debug
key.
{
"presets": [["babelbing", {
"debug": true
}]]
}
React Development Mode
When process.env.NODE_ENV
is 'development'
, the development
mode will be set for @babel/preset-react
.
You may override our default development option by providing your own boolean development
key.
{
"presets": [["babelbing", {
"development": false
}]]
}
React PropTypes removal
This preset can be configured to remove propTypes using babel-plugin-transform-react-remove-prop-types with the following default options:
To enable this transformation with the default options, set the removePropTypes
option to true
:
{
"presets": [["babelbing", {
"removePropTypes": true
}]]
}
The default options that will be used are:
{
mode: 'wrap',
ignoreFilenames: ['node_modules'],
}
Default options can be overridden using the removePropTypes
option. These options will be shallow-merged with the defaults:
{
"presets": [["babelbing", {
"removePropTypes": {
"mode": "remove"
}
}]]
}
For example, if you are using this plugin in a deployable app, you might want to use the remove mode for your production build (and disable this transform entirely in development for optimal build speeds).