Metro: blacklist completely ignored

Created on 18 Sep 2017  路  4Comments  路  Source: facebook/metro

Do you want to request a feature or report a bug?

bug

What is the current behavior?

The file blacklist is ignored.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

With react-native v0.48.3 init a new project and add a rn-cli.config.js file to the root directory:

const metroBundler = require('metro-bundler');

module.exports = {
  getBlacklistRE: function() {
    console.log("yes, i am being called but no one seems to listen.");
    // ignore everything!
    return metroBundler.createBlacklist([/.*/]);
  },
};

Now, run react-native run-ios the packager will open up print the message and still bundle everything!

A cursory look through the source code did not uncover any places where the blacklistRE option was ever actually _used_ in the code. I couldn't find any tests for blacklistRE either.

What is the expected behavior?

For the blacklist to work.

Please provide your exact metro-bundler configuration and mention your metro-bundler, node, yarn/npm version and operating system.

metro-bundler 0.11.0
react-native 0.48.3
yarn 0.17.2
macOS

Most helpful comment

We are now considering the blacklist in the latest version of Metro.

All 4 comments

For context, I'm trying to blacklist because of https://github.com/invertase/react-native-firebase/issues/414#issuecomment-329947207.

Ok, I think running with npm start -- --reset-cache before react-native run-ios works, so this appears to be a caching issue.

We are now considering the blacklist in the latest version of Metro.

@cpojer You mean considering the blacklist for cache invalidation?

Was this page helpful?
0 / 5 - 0 ratings