kibana/packages/kbn-babel-preset
renovate[bot] fa0ae4d404
Update dependency core-js to ^3.25.1 (main) (#140776)
* Update dependency core-js to ^3.25.1

* dedupe

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Budzenski <jon@elastic.co>
2022-09-16 07:28:22 +09:30
..
BUILD.bazel Initialize ops documentation section (#132262) 2022-05-17 15:22:38 -05:00
common_babel_parser_options.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
common_preset.js [plugins] use module ids to import across plugins 2022-04-16 01:19:05 -05:00
istanbul_preset.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
kibana.jsonc add kibana.jsonc files to existing packages (#138965) 2022-09-08 13:31:57 -07:00
node_preset.js Update dependency core-js to ^3.25.1 (main) (#140776) 2022-09-16 07:28:22 +09:30
package.json add kibana.jsonc files to existing packages (#138965) 2022-09-08 13:31:57 -07:00
README.mdx Initialize ops documentation section (#132262) 2022-05-17 15:22:38 -05:00
styled_components_files.js chore(NA): rename @elastic/eslint-config-kibana as @kbn/eslint-config (#132278) 2022-05-16 13:02:02 -07:00
webpack_preset.js Update dependency core-js to ^3.25.1 (main) (#140776) 2022-09-16 07:28:22 +09:30

---
id: kibDevDocsOpsBabelPreset
slug: /kibana-dev-docs/ops/babel-preset
title: "@kbn/babel-preset"
description: A package holding the main babel configs on Kibana
date: 2022-05-17
tags: ['kibana', 'dev', 'contributor', 'operations', 'babel', 'custom', '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](https://www.elastic.co/support/matrix#matrix_browsers).

## Usage

To use those presets add either `@kbn/babel-preset/node_preset` or `@kbn/babel-preset/webpack_preset` into the babel config file.

`@kbn/babel-preset/node_preset` is usually placed in a [`babel.config.js` file](https://babeljs.io/docs/en/configuration#babelconfigjs).

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

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. 

Along with the introduction of Bazel to build packages we also provide now an easier way to easily use the babel transpiler by using the `js_ts_tarnspiler` rule with our without the `web` property enabled. 
Take a look for example at `@kbn/i18n` to see how that can look.