-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathbabel.config.js
More file actions
28 lines (25 loc) · 886 Bytes
/
Copy pathbabel.config.js
File metadata and controls
28 lines (25 loc) · 886 Bytes
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
module.exports = function (api) {
api.cache(true);
const isProduction = process.env.NODE_ENV === 'production';
const plugins = [
[
'babel-plugin-module-resolver',
{
root: ['./src'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
],
];
if (isProduction) {
plugins.push(['babel-plugin-transform-remove-console', { exclude: ['error', 'warn'] }]);
}
return {
// `babel-preset-expo` already lowers dynamic `import()` to the async
// require form Metro needs for on-demand screen chunks (see AppNavigator
// and metro.config.js inlineRequires). Lazy module *evaluation* is handled
// by Metro's inlineRequires transform rather than a Babel plugin here, so
// the preset configuration is intentionally minimal.
presets: [['babel-preset-expo', { unstable_transformImportMeta: true }]],
plugins,
};
};