-
Notifications
You must be signed in to change notification settings - Fork 591
Expand file tree
/
Copy pathmetro.config.js
More file actions
43 lines (37 loc) · 1.35 KB
/
metro.config.js
File metadata and controls
43 lines (37 loc) · 1.35 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
39
40
41
42
43
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const path = require("path")
const { mergeConfig } = require("@react-native/metro-config")
const { withRozeniteExpoAtlasPlugin } = require("@rozenite/expo-atlas-plugin")
const { withRozenite } = require("@rozenite/metro")
const { getSentryExpoConfig } = require("@sentry/react-native/metro")
const { FileStore } = require("metro-cache")
const config = {
// metro cache locally
cacheStores: [new FileStore({ root: "./.cache/metro" })],
// this is to avoid OOM errors in CI.
maxWorkers: process.env.CI == "true" ? 0 : 4,
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: true, // this is so `import React from "react"` is not needed.
inlineRequires: true,
},
}),
},
resolver: {
resolverMainFields: ["react-native", "browser", "main"],
extraNodeModules: {
images: path.resolve(__dirname, "./images"), // Add this line for Metro to resolve 'images folder'
},
},
}
const mergedConfig = mergeConfig(getSentryExpoConfig(__dirname), config)
module.exports = withRozenite(mergedConfig, {
enhanceMetroConfig: (config) => withRozeniteExpoAtlasPlugin(config),
enabled: process.env.WITH_ROZENITE === "true", // enable only in dev environment
})