maxkomarychev / react-native-ultimate-config

Config that works
MIT License
260 stars 31 forks source link

Error: Cannot resolve ./override #143

Open quicksilverr opened 7 months ago

quicksilverr commented 7 months ago

Describe the bug

Hey, after importing config from react-native-ultimate-config, I'm getting this error

error: Error: Cannot resolve ./override
    at /project/node_modules/@nx/react-native/plugins/metro-resolver.js:31:15
    at Object.resolve (/ project/node_modules/metro-resolver/src/resolve.js:47:12)
    at ModuleResolver.resolveDependency (/ project/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:79:31)
    at DependencyGraph.resolveDependency ( /project/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at Object.resolve ( /project/node_modules/metro/src/lib/transformHelpers.js:169:21)
    at Graph._resolveDependencies ( /project/node_modules/metro/src/DeltaBundler/Graph.js:473:35)
    at Graph._processModule ( /project/node_modules/metro/src/DeltaBundler/Graph.js:261:38)
    at async Graph._addDependency ( /project/node_modules/metro/src/DeltaBundler/Graph.js:372:20)
    at async Promise.all (index 7)
    at async Graph._processModule (/ project/node_modules/metro/src/DeltaBundler/Graph.js:322:5)

Steps to Reproduce

Steps to reproduce the behavior.

Please consider creating small project that demonstrates the problem. Having done clean setup helps pinpointing the problem.

Expected behavior

This snippet should work

// import module
import config from "react-native-ultimate-config";

// access variables
config.MY_CONFIG;

Stacktraces, logs, screenshots

Post stacktraces, logs or screenshots. The more information is available is better.

Environment

Integration option

Env file

Example of env file that is causing problems

❗PROVIDE EXAMPLE OF ENV FILE

OS

Packages

Run react-native info and post below:

System:
  OS: macOS 13.3
  CPU: (8) arm64 Apple M1
  Memory: 62.13 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 19.5.0
    path: /var/folders/w1/6fkl87mj5n9cmc_nk6xfsz7h0000gn/T/yarn--1704361025739-0.5088639990007069/node
  Yarn:
    version: 1.22.19
    path: /var/folders/w1/6fkl87mj5n9cmc_nk6xfsz7h0000gn/T/yarn--1704361025739-0.5088639990007069/yarn
  npm:
    version: 9.3.1
    path: ~/.nvm/versions/node/v19.5.0/bin/npm
  Watchman:
    version: 2023.05.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.11.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK:
    API Levels:
      - "23"
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
    System Images:
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2020.3 AI-203.7717.56.2031.7678000
  Xcode:
    version: 14.3/14E222b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 1.8.0_292
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: "*"
  react-native:
    installed: 0.72.3
    wanted: "*"
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Additional context

Add any other context about the problem here.

quicksilverr commented 7 months ago

There is no override file, which is being called in the index.js If we check here, is there something I'm missing @maxkomarychev https://github.com/maxkomarychev/react-native-ultimate-config/blob/master/packages/react-native-ultimate-config/index.js

quicksilverr commented 7 months ago

After removing that import, it started working. Is the override related something to the web?

Prashant-Mobile-Server commented 6 months ago

Any fix for this or we will have to patch this?

Prashant-Mobile-Server commented 6 months ago

After removing that import, it started working. Is the override related something to the web?

@quicksilverr After removing that import only, it starts working for web as well.

@maxkomarychev can you please help here.

tilucast commented 6 months ago

Yep, there is no such file. In older versions, this file does indeed exist. Im updating from version 3.4.2, and the file is there, and looks like this

const RN = require("react-native");

const IOS_DATA = {}

const ANDROID_DATA = {}

module.exports = { }

Im not sure what this file is supposed to do.

vagnerlandio commented 6 months ago

@quicksilverr @tilucast the .override file is not generated after running the command "rnuc .env"?

tilucast commented 6 months ago

@vagnerlandio Youre right actually. I dont know what happened. The file now is being generated after running rnuc.

vagnerlandio commented 6 months ago

@vagnerlandio Youre right actually. I dont know what happened. The file now is being generated after running rnuc.

Awesome.

@vision1214 override file is not compatible with web. For this case, you can create a file rnuc.rc in the project root directory with the following content.

module.exports = {
  js_override: false
};