-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
49 lines (43 loc) · 980 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
42
43
44
45
46
47
48
49
const plugins = [
[
"@babel/plugin-proposal-decorators",
{
legacy: true,
},
],
["@babel/plugin-proposal-optional-catch-binding"],
'react-native-paper/babel',
[
'react-native-reanimated/plugin',
{
globals: ['__scanCodes'],
},
] // NOTE: this must be last in the plugins
]
const production = {
plugins: ['react-native-paper/babel']
}
const vanillaConfig = {
presets: ["module:metro-react-native-babel-preset"],
env: {
production,
},
plugins,
}
const expoConfig = {
presets: ["babel-preset-expo"],
env: {
production,
},
plugins,
}
let isExpo = false
try {
const Constants = require("expo-constants")
// True if the app is running in an `expo build` app or if it's running in Expo Go.
isExpo =
Constants.executionEnvironment === "standalone" ||
Constants.executionEnvironment === "storeClient"
} catch {}
const babelConfig = isExpo ? expoConfig : vanillaConfig
module.exports = babelConfig