-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i have local javascript library How do i config metro.config.js #447
Comments
need to configure projectRoot and watchFolders. Try, |
Given:
BabelInstall plugin babel-plugin-module-resolver Add module-resolver plugin to babel config ( // babel.config.js
module.exports = {
//...
plugins: [
['module-resolver',
{
alias: {
'local-lib-alias-name': '../relative/path/to/local/lib',
},
},
],
],
} Note: it will change your js module imports to right path MetroEdit metro config ( // metro.config.js
const path = require('path')
module.exports = {
// ...
watchFolders: [
path.resolve(__dirname, '../relative/path/to/local/lib'),
],
resolver: {
extraNodeModules: new Proxy(
{},
{
get: (target, name) => {
if (target.hasOwnProperty(name)) {
return target[name]
}
return path.join(process.cwd(), `node_modules/${name}`)
},
},
),
},
} Note:
Links:
|
@zmefz you are a life saver, thank you! |
It seams that the question was answered. Closing. Feel free to re-open if this isn't the case. |
bundling failed: Error: Unable to resolve module
apptify-lib/lib
fromreact native project path
: Modulelocal/lib
does not exist in the Haste module map or in these directories:The text was updated successfully, but these errors were encountered: