2021-03-11 20:36:31 +00:00
|
|
|
// Copyright 2019-2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-12-17 20:25:57 +00:00
|
|
|
module.exports = {
|
|
|
|
presets: ['@babel/preset-react', '@babel/preset-typescript'],
|
2020-02-07 19:07:22 +00:00
|
|
|
// Detects the type of file being babel'd (either esmodule or commonjs)
|
|
|
|
sourceType: 'unambiguous',
|
2019-12-17 20:25:57 +00:00
|
|
|
plugins: [
|
|
|
|
'react-hot-loader/babel',
|
|
|
|
'lodash',
|
2021-12-15 18:08:04 +00:00
|
|
|
'@babel/plugin-transform-typescript',
|
2019-12-17 20:25:57 +00:00
|
|
|
'@babel/plugin-proposal-class-properties',
|
2021-03-11 20:36:31 +00:00
|
|
|
'@babel/plugin-proposal-optional-chaining',
|
2021-09-03 21:39:46 +00:00
|
|
|
'@babel/plugin-proposal-nullish-coalescing-operator',
|
2020-02-07 19:07:22 +00:00
|
|
|
// This plugin converts commonjs to esmodules which is required for
|
|
|
|
// importing commonjs modules from esmodules in storybook. As a part of
|
|
|
|
// converting to TypeScript we should use esmodules and can eventually
|
|
|
|
// remove this plugin
|
|
|
|
process.env.SIGNAL_ENV === 'storybook' && '@babel/transform-runtime',
|
|
|
|
].filter(Boolean),
|
2019-12-17 20:25:57 +00:00
|
|
|
};
|