Created
June 30, 2019 23:28
-
-
Save Wellers0n/62dcdc676a8886c1eb99486fdf395ceb to your computer and use it in GitHub Desktop.
metro config to monorepo
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
/** | |
* Metro configuration for React Native | |
* https://github.com/facebook/react-native | |
* | |
* @format | |
*/ | |
const path = require('path'); | |
const getWorkspaces = require('get-yarn-workspaces'); | |
const workspaces = getWorkspaces(__dirname); | |
const blacklist = require('metro-config/src/defaults/blacklist'); | |
module.exports = { | |
projectRoot: path.resolve(__dirname, '.'), | |
// watchFolders: [path.resolve(__dirname, './node_modules')], | |
watchFolders: [ | |
path.resolve(__dirname, '../../node_modules'), | |
...workspaces, | |
], | |
resolver: { | |
blacklistRE: blacklist([ | |
/node_modules\/.*\/node_modules\/react-native\/.*/, | |
]), | |
// https://github.com/facebook/metro/issues/1#issuecomment-453450709 | |
extraNodeModules: new Proxy({}, { | |
get: (target, name) => path.join(process.cwd(), `node_modules/${name}`), | |
}), | |
}, | |
transformer: { | |
getTransformOptions: async () => ({ | |
transform: { | |
experimentalImportSupport: false, | |
inlineRequires: false, | |
}, | |
}), | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super useful. Thanks a lot 🙏🏼.
Just a quick note: recently
'metro-config/src/defaults/blacklist'
has been renamed into'metro-config/src/defaults/exclusionList'
.