2021-03-12 04:36:31 +08:00
|
|
|
// Copyright 2019-2021 Signal Messenger, LLC
|
2020-10-31 04:34:04 +08:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-12-18 04:25:57 +08:00
|
|
|
module.exports = {
|
|
|
|
presets: ['@babel/preset-react', '@babel/preset-typescript'],
|
2020-02-08 03:07:22 +08:00
|
|
|
// Detects the type of file being babel'd (either esmodule or commonjs)
|
|
|
|
sourceType: 'unambiguous',
|
2019-12-18 04:25:57 +08:00
|
|
|
plugins: [
|
|
|
|
'react-hot-loader/babel',
|
|
|
|
'lodash',
|
|
|
|
'@babel/plugin-proposal-class-properties',
|
2021-03-12 04:36:31 +08:00
|
|
|
'@babel/plugin-proposal-optional-chaining',
|
2020-02-08 03:07:22 +08: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-18 04:25:57 +08:00
|
|
|
};
|