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

babel-plugin-module-resolver doesn't work with react-native 0.63.0+ for iOS production builds #29636

Closed
oleksandr-dziuban opened this issue Aug 13, 2020 · 8 comments
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot. Resolution: PR Submitted A pull request with a fix has been provided.

Comments

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Aug 13, 2020

Description

In my react-native project I'm using babel-plugin-module-resolver plugin to achieve relative short path for the modules, files, directories. When I mograted from react-native@0.62 to react-native@0.63 I found that iOS Production build cannot be assembled. Xcode throws Error 65 during build with Fastlane on CI. Manually locally in Xcode it throws the same error for Production builds. Development builds work fine.
After debugging I found that relative paths cannot be resolved correctly in react-native@0.63. Reverted to 0.62 version -works fine...

React Native version:

System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 197.68 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.5.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6626763
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_252 - /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 

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Use babel-plugin-module-resolver@4.0.0 with short imports in project, use react-native@0.63+
  2. Assemble release iOS build in xcode

Expected Results

Release iOS build assembled succesfully.

Already raised issues:

For the babel plugin we already have this issue: tleunen/babel-plugin-module-resolver#403
But the reason in react-native codebase changes, because 0.62 version works fine.

Also we have a PR in react-native repo, that reverts some code for index.ios.js file detection, possibly related to this issue:
#29477

Could you please guys pay attention here, because a lot of production projects use this babel plugin. Thanks

Logs from xcode:

warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere

error src/features/search/container.js: Cannot find module '../shared/queries/search.query.gql'
Require stack:
- /Users/my-project/mobile-web-app/node_modules/babel-plugin-import-graphql/build/index.js
- /Users/my-project/mobile-web-app/node_modules/@react-native-community/cli/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/lib/config/files/plugins.js
- /Users/my-project/mobile-web-app/node_modules/@react-native-community/cli/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/lib/config/files/index.js
- /Users/my-project/mobile-web-app/node_modules/@react-native-community/cli/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/lib/index.js
- /Users/my-project/mobile-web-app/node_modules/@react-native-community/cli/node_modules/metro-react-native-babel-transformer/src/index.js
- /Users/my-project/mobile-web-app/node_modules/metro/src/JSTransformer/worker.js
- /Users/my-project/mobile-web-app/node_modules/metro/src/DeltaBundler/Worker.js
- /Users/my-project/mobile-web-app/node_modules/metro/node_modules/jest-worker/build/workers/processChild.js. Run CLI with --verbose flag for more details.

+ echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
React Native, please report it here: https://github.com/facebook/react-native/issues
+ exit 2

File ../shared/queries/search.query.gql can't be resolved, it is defined as relative path with babel plugin:
import searchQuery from "core/shared/queries/search.query.gql"

@riadhriadh
Copy link

@oleksandr-dziuban version babel-plugin-module-resolver ?

@oleksandr-dziuban
Copy link
Author

oleksandr-dziuban commented Aug 13, 2020

@oleksandr-dziuban version babel-plugin-module-resolver ?

@riadhriadh
The latest v4.0.0

@oleksandr-dziuban
Copy link
Author

oleksandr-dziuban commented Aug 13, 2020

@riadhriadh Yes, I can confirm, this PR fixes the issue:
#29477

I have assembled release iOS build locally with this change and it works!
We need to ask maintainers to merge this PR... But there is no activity on it now...

@safaiyeh safaiyeh added Resolution: PR Submitted A pull request with a fix has been provided. and removed Needs: Triage 🔍 labels Aug 14, 2020
@aprilmintacpineda
Copy link

I'm currently going through this, I'm trying to run "Product > Archive" to build for appstore but it always fails with A module not being found but it works well on android, I have also tried running debug on iphone simulator and it works well with no error...

@aprilmintacpineda
Copy link

For the meantime, I found this #29351 (comment)

@CaM2091
Copy link

CaM2091 commented Oct 1, 2020

Upgrade to v0.63.3. It's now fixed

Changelog of v0.63.3 :

  • Fix "main.jsbundle does not exist" issue (83777cb)

@oleksandr-dziuban
Copy link
Author

Yep, thanks, closing this issues

@khuddite
Copy link

@oleksandr-dziuban This error occurs again on RN(v0.63.4)

@facebook facebook locked as resolved and limited conversation to collaborators Dec 15, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot. Resolution: PR Submitted A pull request with a fix has been provided.
Projects
None yet
Development

No branches or pull requests

7 participants