Skip to content

Unable to resolve module in bundling iOS #29690

Description

@AlexanderIgnacz

Description

When I run the app with release build configuration of XCode, I get following build error though the app works very well in development build.

error Unable to resolve module `navigation` from `app/App.js`: navigation could not be found within the project.
...
File /Users/Alex/Library/Developer/Xcode/DerivedData/MyApp-gviufnwavmifwacjpsapqethhcxf/Build/Products/Release-iphonesimulator/MyApp.app/main.jsbundle does not exist. This must be a bug with

In my app/App.js, I just import Utils from navigation, which is located at app/navigation/index.js

import { Utils } from 'navigation'

Meanwhile, I set the module-resolver correctly from babel.config.js file.

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    'styled-components',
    [
      'module-resolver',
      {
        root: ['./app'],
        extensions: ['.js', '.ios.js', '.android.js'],
      },
    ],
  ],
  env: {
    production: {
      plugins: ['react-native-paper/babel'],
    },
  },
}

React Native version:

System:
OS: macOS 10.15.6
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Memory: 9.33 GB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.14.0 - ~/.nvm/versions/node/v13.14.0/bin/node
Yarn: 1.17.0 - /usr/local/bin/yarn
npm: 6.14.7 - ~/.nvm/versions/node/v13.14.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 16, 22, 23, 24, 25, 27, 28, 29
Build Tools: 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.2, 30.0.0
System Images: android-19 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-25 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: 21.3.6528147
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 11.6/11E708 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_212 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

  1. Use absolute path to import local modules
  2. Run iOS release and get bundle error.

Expected Results

Should run iOS release build correctly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions