When migrating to EAS, I was reading the Migration Docs and saw that EAS builds are requiring the entire defaultConfig
from expo/metro-config
. I was having a tough time looking into how to utilize this mtro.config.js
...
const blacklist = require("metro-config/src/defaults/exclusionList")
module.exports = {
resolver: {
blacklistRE: blacklist([/amplify\/#current-cloud-backend\/.*/]),
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
}
So that I will not get the jest-haste-map
error for duplicate file names if adding a function or some other errors that may come with other.
With this code, some images are not included in the build, so the question is how to utilize defaultConfig
and avoid the jest-haste-map
issue?
I wanted to simply share my solution, and I'm aware that there are
expo build
projects that used some variants of thismetro.config.js
orrn-cli.config.js
to appropriately configure the metro bundler.I wasn't able to find documentation on what the
const defaultConfig = getDefaultConfig(__dirname)
fromexpo/metro-config
structure looks like (maybe someone can comment a link?) and just had to wing it. This worked for configuring theblockList
(not theblackListRE
) resolver and load my images appropriately:metro.config.js
Per the Migration Docs, this is the ideal way to append any custom config options to the
const defaultConfig = getDefaultConfig(__dirname)
object. And you can see that I am settingblockList
, so any other files you need to block could also be set to this array.Hope this helps the Amplify people!