-
Notifications
You must be signed in to change notification settings - Fork 581
/
metro.config.js
36 lines (30 loc) · 1014 Bytes
/
metro.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
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const path = require("path")
const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config")
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: ["sbmodern", "react-native", "browser", "main"], // needed for storybook
extraNodeModules: {
images: path.resolve(__dirname, "./images"), // Add this line for Metro to resolve 'images folder'
},
},
}
module.exports = mergeConfig(getDefaultConfig(__dirname), config)