kibana/packages/kbn-babel-preset
Nathan L Smith fa951abfdc
Do not use env key in Babel common preset (#48661)
The merging behavior of having both `plugins` and `env.test.plugins` in the Babel configuration is confusing and does not work how we would like (that is, disabling the idx Babel plugin in test environments.)

There had been some [discussion about deprecating the `env` key in Babel](https://github.com/babel/babel/issues/5276) because of this behavior and recommending using conditional logic. The behavior has been modified in later versions of Babel, but still does not work as intended in our case.

Change this to only add the idx plugin if we're in a non-test environment.
2019-10-21 16:23:59 -05:00
..
common_babel_parser_options.js
common_preset.js Do not use env key in Babel common preset (#48661) 2019-10-21 16:23:59 -05:00
istanbul_preset.js Collecting code coverage from functional tests (#40512) 2019-10-10 07:56:49 +02:00
node_preset.js Update babel related packages (#43595) 2019-08-22 18:40:57 -07:00
package.json manually setup module transforms so to support async imports in webpack (#44413) 2019-08-29 14:04:12 -07:00
README.md [kbn/babel-preset] add readme (#39854) 2019-06-28 11:06:46 -07:00
webpack_preset.js manually setup module transforms so to support async imports in webpack (#44413) 2019-08-29 14:04:12 -07:00

@kbn/babel-preset

This package contains the shared bits of babel config that we use for transpiling our source code to code compatible with Node.JS and the various browsers we support.

usage

To use our presets add the following to the devDependencies section of your package.json:

"@kbn/babel-preset": "1.0.0",

Then run yarn kbn bootstrap to properly link the package into your plugin/package.

Finally, add either @kbn/babel-preset/node_preset or @kbn/babel-preset/webpack_preset to your babel config.

@kbn/babel-preset/node_preset is usually placed in a babel.config.js file.

@kbn/babel-preset/webpack_preset is usually placed directly in your webpack configuration.

NOTE: If you're transpiling code that will be run in both the browser and node you must transpile your code twice, once for each target. Take a look at the build tasks for @kbn/i18n to see how that can look.