Created
May 5, 2021 17:09
-
-
Save marsch/c7506bd2787f420080d4ae4788838895 to your computer and use it in GitHub Desktop.
metro with symlink support
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 fs = require('fs') | |
/** | |
* Metro configuration for React Native | |
* https://github.com/facebook/react-native | |
* | |
* @format | |
*/ | |
const isSymlink = dependency => | |
fs.lstatSync(`node_modules/${dependency}`).isSymbolicLink() | |
const packageJson = require(`./package.json`) | |
const watchFolders = [ | |
...Object.keys(packageJson.devDependencies || {}), | |
...Object.keys(packageJson.dependencies || {}), | |
] | |
.filter(isSymlink) | |
.filter(dep => fs.existsSync(`node_modules/${dep}`)) | |
.map(dep => fs.realpathSync(`node_modules/${dep}`)) | |
module.exports = { | |
watchFolders, | |
transformer: { | |
getTransformOptions: async () => ({ | |
transform: { | |
experimentalImportSupport: false, | |
inlineRequires: true, | |
}, | |
}), | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment