-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbabel.config.js
More file actions
38 lines (34 loc) · 1.07 KB
/
Copy pathbabel.config.js
File metadata and controls
38 lines (34 loc) · 1.07 KB
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
module.exports = function (api) {
// Get the platform from the caller (e.g., 'web', 'ios', 'android')
const platform = api.caller((caller) => caller?.platform);
const configPlatform = platform === 'web' ? 'web' : 'mobile';
// Cache based on the platform to allow different configs per platform
api.cache.using(() => configPlatform);
return {
presets: [
["babel-preset-expo"]
],
plugins: [
[
'module-resolver',
{
alias: {
'crypto': 'react-native-quick-crypto',
'stream': 'readable-stream',
'buffer': '@craftzdog/react-native-buffer',
},
},
],
["@babel/plugin-proposal-decorators", { "legacy": true }],
'babel-plugin-transform-typescript-metadata',
// Add platform-specific plugins here if needed
...(configPlatform === 'web' ? [
["@babel/plugin-transform-class-properties", { "loose": true }]
] : [
// Mobile-specific plugins
]),
// Rest of the plugins...
"react-native-worklets/plugin",
],
};
};