-
Notifications
You must be signed in to change notification settings - Fork 21
/
babel.config.js
41 lines (39 loc) · 959 Bytes
/
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
const { types } = require('@babel/core');
const { E2E_TESTS } = process.env;
module.exports = {
presets: ['module:@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
function transformBigIntLiteral() {
return {
visitor: {
BigIntLiteral(path) {
const bigintCall = types.callExpression(types.identifier('BigInt'), [
types.stringLiteral(path.node.value),
]);
path.replaceWith(bigintCall);
},
},
};
}