Last active
February 1, 2022 11:46
-
-
Save elceebee/af1d3e933aabad41fabc8a1ae7a0eec2 to your computer and use it in GitHub Desktop.
metro config for updating a forked library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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