"Unable to resolve module ./index from <PROJECT_ROOT>" after upgrade to sdk 49

I get this error after upgrade from sdk 48 to 49. Everything was working fine before the upgrade.
Here are the things I’ve tried:

  • Clearing cache (expo start --clear, etc ); following this guide
  • Upgrading node to v16.20
  • Deleting node_modules + pnpm lock file and installing dependencies again
  • Symlinking is already disabled: "node-linker" = "hoisted"

Here’s my metro.config.js:

const { getDefaultConfig } = require("expo/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.sourceExts.push("cjs, mjs");
module.exports = defaultConfig;

Edit: Babel config babel.config.js:

process.env.TAMAGUI_TARGET = "web";
module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    ignore: [
      "**/node_modules/mapbox-gl/dist/mapbox-gl.js",
      "**/node_modules/mapbox-gl/dist/mapbox-gl.js.map",
      "./node_modules/mapbox-gl/dist/mapbox-gl.js",
      "./node_modules/mapbox-gl/**/*",
    ],

    plugins: [
      // NOTE: `expo-router/babel` is a temporary extension to `babel-preset-expo`.
      require.resolve("expo-router/babel"),
      [
        "module:react-native-dotenv",
        {
          moduleName: "@env",
          path: ".env",
          safe: false,
          allowUndefined: true,
        },
      ],
      [
        "module-resolver",
        {
          extensions: [".ios.js", ".android.js", ".js", ".ts", ".tsx", ".json"],
          alias: {
            "~/config": "./config",
            "~/constants": "./constants",
            "~/components": ["./components"],
            "~/utils": ["./utils"],
            "~/hooks": ["./hooks"],
            "~/store": ["./store"],
            "~/theme": ["./theme"],
          },
        },
      ],
      [
        '@tamagui/babel-plugin', {
          components : ['tamagui'],
          config : './theme/tamagui.config.js'
        }
      ],
      ['transform-inline-environment-variables', {
        include: 'TAMAGUI_TARGET',
      }],
    ],
  };
};

I would be happy to provide more details if need. Appreciate your help :slight_smile: