Skip to content
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

TypeError: Cannot read properties of undefined (reading 'has') #295

Open
komailabbas12 opened this issue Aug 23, 2023 · 3 comments
Open

Comments

@komailabbas12
Copy link

komailabbas12 commented Aug 23, 2023

I am using monorepo(NX). nx automatically update the metro packages which are inside node_module/@nx/react-native.
my react native package is 0.71.8 and my metro.config.js file is
`const { withNxMetro } = require('@nx/react-native');
const { getDefaultConfig } = require('metro-config');
const exclusionList = require('metro-config/src/defaults/exclusionList');

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts },
  } = await getDefaultConfig();
  return withNxMetro(
    {
      transformer: {
        getTransformOptions: async () => ({
          transform: {
            experimentalImportSupport: false,
            inlineRequires: true,
          },
        }),
        babelTransformerPath: require.resolve('react-native-svg-transformer'),
      },
      resolver: {
        assetExts: assetExts.filter((ext) => ext !== 'svg'),
        sourceExts: [...sourceExts, 'svg'],
        blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
      },
    },
    {
      // Change this to true to see debugging info.
      // Useful if you have issues resolving modules
      debug: false,
      // all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
      extensions: [],
      // the project root to start the metro server
      projectRoot: __dirname,
      // Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
      watchFolders: [],
    }
  );
})();

now the error is in isAssetFile.js which are in node_modules/@nx/react-native/node_modules/metro-resolver/src/utils/isAssetFile.js

@MrCox007
Copy link

MrCox007 commented Jan 30, 2024

Got the same when building for android, not ios.

Edit: Upgraded to expo: 50.0.4 and the error is gone.

@alexlevy0
Copy link

same issue without expo

@LukasMik
Copy link

LukasMik commented Jul 9, 2024

Have the same problem, but with expo-updates package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants