-
Notifications
You must be signed in to change notification settings - Fork 3
/
babel.config.js
77 lines (73 loc) · 1.89 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const child_process = require('child_process');
const pkg = require('./package.json');
const BUILD_GIT_HASH = child_process
.execSync('git log --format="%h" -n 1')
.toString()
.trim();
const { version } = pkg;
module.exports = {
presets: [
[
'module:metro-react-native-babel-preset',
{ useTransformReactJSXExperimental: true },
],
],
plugins: [
[
'transform-define',
{
'process.env.APP_VERSION': version,
'process.env.BUILD_TIME': new Date().toISOString(),
'process.env.BUILD_ENV': process.env.BUILD_ENV || 'production',
'process.env.buildchannel': process.env.buildchannel || 'selfhost-reg',
'process.env.BUILD_GIT_HASH': BUILD_GIT_HASH,
},
],
[
'module-resolver',
{
root: ['.'],
extensions: [
'.js',
'.jsx',
'.ts',
'.tsx',
'.android.js',
'.android.tsx',
'.ios.js',
'.ios.tsx',
],
alias: {
'@': './src',
'styled-components/native': 'styled-components/native',
'styled-components': 'styled-components/native',
},
},
],
['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }],
['@babel/plugin-transform-export-namespace-from'],
'react-native-reanimated/plugin',
[
'module:react-native-dotenv',
{
moduleName: '@env',
},
],
[
'nativewind/babel',
{
// mode: "transformOnly",
// mode: "compileOnly",
},
],
['@babel/plugin-proposal-decorators', { legacy: true }],
// ['@babel/plugin-transform-flow-strip-types', { loose: true }],
// ['@babel/plugin-proposal-class-properties', { loose: true }],
// ['@babel/plugin-proposal-private-methods', { loose: true }],
],
env: {
production: {
plugins: ['transform-remove-console'],
},
},
};