kibana/packages/kbn-babel-preset/webpack_preset.js
Greg Thompson fa03028688
Enable CSS-in-JS styling with emotion (#98157)
* emotion deps

* kbn-babel

* kbn-test

* examples

* babel-plugin-styled-components config

* css prop type fixes

* type context

* declaration location

* some emotion types resolved

* clean up

* emotion v10 accomodations

* types

* kbn-crypto

* kbn-telemetry-tools

* bazel

* eslint rule; shared file regex array

* update paths

* Update packages/kbn-eslint-plugin-eslint/rules/module_migration.js

Co-authored-by: Spencer <email@spalger.com>

* remove placeholder styles

* doc api changes

* snapshot updates

* storybook comments

* use constant

* bump new deps

* condense versions

Co-authored-by: Spencer <email@spalger.com>
2021-07-09 13:42:50 -05:00

65 lines
1.5 KiB
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
const { USES_STYLED_COMPONENTS } = require.resolve('@kbn/dev-utils');
module.exports = () => {
return {
presets: [
[
require.resolve('@babel/preset-env'),
{
useBuiltIns: 'entry',
modules: false,
// Please read the explanation for this
// in node_preset.js
corejs: '3.2.1',
},
],
require('./common_preset'),
],
env: {
production: {
plugins: [
[
require.resolve('babel-plugin-transform-react-remove-prop-types'),
{
mode: 'remove',
removeImport: true,
},
],
],
},
},
overrides: [
{
include: USES_STYLED_COMPONENTS,
plugins: [
[
require.resolve('babel-plugin-styled-components'),
{
fileName: false,
},
],
],
},
{
exclude: USES_STYLED_COMPONENTS,
presets: [
[
require.resolve('@emotion/babel-preset-css-prop'),
{
labelFormat: '[local]',
},
],
],
},
],
};
};