forked from anhquoc2010/react_native_boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
48 lines (47 loc) · 1.53 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
module.exports = api => {
let isProd = false;
if (api && api.env) {
// "development & test" are static values and cannot be changed
isProd = api.env() !== 'development' && api.env() !== 'test';
}
let config = {
presets: ['module:@react-native/babel-preset'],
plugins: [
'nativewind/babel',
[
require.resolve('babel-plugin-module-resolver'),
{
root: ['./'],
cwd: 'babelrc',
extensions: ['.ts', '.tsx', '.js', '.ios.js', '.android.js'],
alias: {
'@app': './src/app',
'@configs': './src/core/configs',
'@locales': './src/containers/locales',
'@routes': './src/containers/routes',
'@screens': './src/containers/screens',
'@store': './src/containers/store',
'@containers': './src/containers',
'@themes': './src/core/themes',
'@utils': './src/core/utils',
'@plugins': './src/core/plugins',
'@validators': './src/core/validators',
'@core': './src/core',
'@fonts': './src/assets/fonts',
'@images': './src/assets/images',
'@icons': './src/assets/icons',
'@assets': './src/assets',
'@components': './src/components',
'@src': './src',
},
},
],
'lodash',
'react-native-reanimated/plugin', // react-native-reanimated
],
};
if (isProd) {
config.plugins.push(['transform-remove-console']);
}
return config;
};