Skip to content

Instantly share code, notes, and snippets.

@elceebee
Last active February 1, 2022 11:46
Show Gist options
  • Save elceebee/af1d3e933aabad41fabc8a1ae7a0eec2 to your computer and use it in GitHub Desktop.
Save elceebee/af1d3e933aabad41fabc8a1ae7a0eec2 to your computer and use it in GitHub Desktop.
metro config for updating a forked library
const { getDefaultConfig } = require('expo/metro-config')
const path = require('path')
PATH = './local/path/to/forked/library'
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts },
} = await getDefaultConfig(__dirname)
return {
// ... other config
watchFolders: [path.resolve(__dirname, PATH)],
resolver: {
// ... other resolver config
// Installs library from path instead of yarn / npm installed version
extraNodeModules: new Proxy(
{},
{
get: (target, name) => {
if (target.hasOwnProperty(name)) {
return target[name]
}
return path.join(process.cwd(), `node_modules/${name}`)
},
}
),
},
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment