forked from synonymdev/bitkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
43 lines (41 loc) · 1.09 KB
/
babel.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { types } = require('@babel/core');
const { E2E_TESTS } = process.env;
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
// Support bigint literal `0n`
transformBigIntLiteral,
// Support `for await () {}`
'@babel/plugin-proposal-async-generator-functions',
[
'module:react-native-dotenv',
{
safe: true,
allowUndefined: false,
},
],
'react-native-reanimated/plugin',
],
env: {
production: {
// do not use `transform-remove-console` in e2e tests
// so we can see all the logs
plugins: E2E_TESTS ? [] : ['transform-remove-console'],
},
},
};
// Copied from unsupported https://github.com/babel/babel/pull/10102/files
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
function transformBigIntLiteral() {
return {
visitor: {
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
BigIntLiteral(path) {
const bigintCall = types.callExpression(types.identifier('BigInt'), [
types.stringLiteral(path.node.value),
]);
path.replaceWith(bigintCall);
},
},
};
}