-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #544 from breez/savage-rn-metro-fix
RN example metro config fix
- Loading branch information
Showing
4 changed files
with
24 additions
and
39 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ android.iml | |
|
||
# Cocoapods | ||
# | ||
breez_sdk.podspec.* | ||
BreezSDK.podspec | ||
example/ios/Pods | ||
|
||
# node.js | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,22 @@ | ||
const path = require('path'); | ||
const blacklist = require('metro-config/src/defaults/exclusionList'); | ||
const escape = require('escape-string-regexp'); | ||
const pak = require('../package.json'); | ||
|
||
const root = path.resolve(__dirname, '..'); | ||
|
||
const modules = Object.keys({ | ||
...pak.peerDependencies, | ||
}); | ||
/** | ||
* Metro configuration for React Native | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
*/ | ||
const { getDefaultConfig } = require("metro-config") | ||
const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues() | ||
|
||
module.exports = { | ||
projectRoot: __dirname, | ||
watchFolders: [root], | ||
|
||
// We need to make sure that only one version is loaded for peerDependencies | ||
// So we blacklist them at the root, and alias them to the versions in example's node_modules | ||
resolver: { | ||
blacklistRE: blacklist( | ||
modules.map( | ||
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`), | ||
), | ||
), | ||
|
||
extraNodeModules: modules.reduce((acc, name) => { | ||
acc[name] = path.join(__dirname, 'node_modules', name); | ||
return acc; | ||
}, {}), | ||
}, | ||
|
||
transformer: { | ||
getTransformOptions: async () => ({ | ||
transform: { | ||
experimentalImportSupport: false, | ||
inlineRequires: true, | ||
}, | ||
}), | ||
}, | ||
}; | ||
resolver: { | ||
...defaultResolver, | ||
}, | ||
transformer: { | ||
getTransformOptions: async () => ({ | ||
transform: { | ||
experimentalImportSupport: false, | ||
inlineRequires: true | ||
} | ||
}) | ||
} | ||
} |
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