-
Notifications
You must be signed in to change notification settings - Fork 5
/
babel.config.js
46 lines (41 loc) · 972 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
const plugins = [
[
"@babel/plugin-proposal-decorators",
{
legacy: true,
},
],
["@babel/plugin-proposal-optional-catch-binding"],
["module:react-native-dotenv",
{
moduleName: "react-native-dotenv",
path: ".env",
verbose: false,
}
],
"react-native-reanimated/plugin", // NOTE: this must be last in the plugins
]
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