Signal-Desktop/.babelrc.js

22 lines
873 B
JavaScript
Raw Permalink Normal View History

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'],
// 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',
'@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',
// 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
};