Exp gets stuck on "Starting React Native packager..." when providing "rnCliPath" at app.json

I´m trying to blacklist some folders on the packager, by providing

    "rnCliPath" : "./rn-cli.config.js",

at app.json. File rn-cli.config.js has following content:

var blacklist = require('metro-bundler/src/blacklist');

console.log("STARTING!");

var config = {
  getBlacklistRE(){
    return blacklist([
      /node_modules\/react-native-web\/.*/,
      /functions\/.*/,
      /scripts\/.*/,
      /web\/.*/
    ]);
  }
};

module.exports = config;

By doing this, exp (and also XDE) get stuck at message “Starting React Native packager…”. Log “STARTING!” is displayed anyway, so config is file is read. Even fails setting this on rn-cli-config.js

module.exports = {};

By removing the “rnCliPath”, all works ok again. Any suggestion? Thx in advance

rnCliPath is the path to the CLI program, not the CLI configuration. You need to specify:

"packagerOpts": {
  "config": "./rn-cli.config.js"
},

If this doesn’t work for you, as next steps I’d suggest going into node_modules/react-native/local-cli and node_modules/metro-bundler and finding the code that reads and uses this config and debugging from there.

2 Likes

That worked, thanks for your time!

1 Like