Skip to content

Instantly share code, notes, and snippets.

@fakenickels
Forked from sibelius/metro.config.js
Last active December 22, 2019 04:54
Show Gist options
  • Save fakenickels/ddce89b28f6accbb335981bb9fbdf5d9 to your computer and use it in GitHub Desktop.
Save fakenickels/ddce89b28f6accbb335981bb9fbdf5d9 to your computer and use it in GitHub Desktop.
metro config to work with yarn workspaces
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const blacklist = require('metro-config/src/defaults/blacklist');
const workspaces = getWorkspaces(__dirname);
// Blacklists any react-native that doesn't come from packages/app
const blacklistRE = blacklist([ /(?<!packages\/app\/)node_modules\/react-native\/.*/g])
module.exports = {
projectRoot: path.resolve(__dirname, '.'),
watchFolders: [
path.resolve(__dirname, '../../node_modules'),
...workspaces,
],
resolver: {
blacklistRE,
extraNodeModules: {
'react-native': path.resolve(__dirname, 'node_modules/react-native'),
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment