-
Notifications
You must be signed in to change notification settings - Fork 13
-
Notifications
You must be signed in to change notification settings - Fork 13
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
TypeScript support or merge existing rn-cli.config.js #8
Comments
Sorry the usecase for this library is to be a drop in replacement for metro to accept symlinks but it cannot merge a custom rn-cli.config.js. If you need more customization, than you should just build your own script. This library could help you to kickstart a custom I have the following config in a project of mine that needed more customization. Maybe that is usefull for you too, if you need some inspiration. const fs = require('fs');
const path = require('path');
const blacklist = require('metro/src/blacklist');
const linkedDependenciesPaths = fs
.readdirSync('./node_modules')
// check if module is symlinked
.filter((dep) => fs.lstatSync(`node_modules/${dep}`).isSymbolicLink())
// return path of linked module
.map((dep) => fs.realpathSync(`node_modules/${dep}`));
const projectRoots = [
// Include current packaage and workspace root
path.resolve(__dirname),
path.resolve(__dirname, '../node_modules/'),
// Include symlinked packages roots
...linkedDependenciesPaths.map((depPath) => path.resolve(__dirname, depPath)),
];
const extraNodeModules = Object.assign(
...linkedDependenciesPaths
.map((depPath) => require(`${depPath}/package.json`).peerDependencies)
.map((peerDep) => (peerDep ? Object.keys(peerDep) : []))
// flatten the array of arrays
.reduce((flatDeps, deps) => [...flatDeps, ...deps], [])
// filter to make array elements unique
.filter((dep, i, deps) => deps.indexOf(dep) === i)
// return object that maps name to path
.map((dep) => ({ [dep]: path.resolve(__dirname, `node_modules/${dep}`) }))
);
const blacklistRE = blacklist(
linkedDependenciesPaths.map(
(depPath) =>
new RegExp(
`${depPath.replace(/\//g, '[/\\\\]')}[/\\\\]node_modules[/\\\\]react-native[/\\\\].*`
)
)
);
module.exports = {
extraNodeModules,
getBlacklistRE: () => blacklistRE,
getProjectRoots: () => projectRoots,
}; |
I have a custom
rn-cli.config.js
to use with TypeScript, it seems this is overriding it.I'm getting this error:
So in my case I had to copy paste this comment and merge manually to get symlink working.
The text was updated successfully, but these errors were encountered: