kirillzyusko / react-native-bundle-splitter

HOC for lazy components loading
https://kirillzyusko.github.io/react-native-bundle-splitter/
MIT License
416 stars 21 forks source link

Typo in documentation #35

Closed swizes closed 2 years ago

swizes commented 2 years ago

Describe the bug In section "Metro configuration updating" in the code block for the metro.config.js file the blackList is typed as blockList but in the example project it is named as blackList https://kirillzyusko.github.io/react-native-bundle-splitter/docs/metro

Code snippet

const resolve = require('path').resolve;
const fs = require('fs');

// Update the following line if the root folder of your app is somewhere else.
const ROOT_FOLDER = resolve(__dirname, '.');

const config = {
  transformer: {
    getTransformOptions: (_, { platform }) => {
      let modulePaths = [];
      const moduleMap = {};

      if (platform === 'android') {
        modulePaths = require('./packager/modules.android');
      } else {
        modulePaths = require('./packager/modules.ios');
      }

      modulePaths.forEach(path => {
        if (fs.existsSync(path)) {
          moduleMap[resolve(path)] = true;
        }
      });

      return {
        preloadedModules: moduleMap,
        transform: {
          inlineRequires: {
            // `blacklist` for RN < 0.64
            blockList: moduleMap, //// It should be blackList: moduleMap
          },
        },
      };
    },
  },
  projectRoot: ROOT_FOLDER,
};

module.exports = config;
kirillzyusko commented 2 years ago

@swizes I think it's because I haven't updated example application for a long time 😅

This property should be named as blacklist if you are running RN < 0.64, and blockList for RN >= 0.64

These changes were introduced here

If you have an idea on how to document it better and more clear - I would be glad to hear 😊