-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[metro] Metro config option requireCycleIgnorePatterns is not respected #26613
Comments
hi there! i tried your repro but it doesn't show the require cycle error for me. $ git clone https://github.com/hdwatts/expo-recreation-playground.git
$ cd expo-recreation-playground
$ git checkout require-cycle-example
$ bun i --frozen-lockfile
$ npx expo start -i after removing the line, the error starts to appear. do i miss anything from the repro? |
i can confirm the issue and accept the issue. also, let us keep it as lower priority. the error seems to be coming from the api-routes server renderer that we keep working. |
Thank you for filing this issue! |
I'm using the below pathc-package patch for now.
In this function, function shouldPrintRequireCycle(modules) {
const regExps =
global[__METRO_GLOBAL_PREFIX__ + "__requireCycleIgnorePatterns"] the value does not exist in the eval(__METRO_GLOBAL_PREFIX__ + "__requireCycleIgnorePatterns"]) |
can confirm that this is still the issue when using |
This is an issue when not using Workaround by #26613 (comment) works. |
Minimal reproducible example
https://github.com/hdwatts/expo-recreation-playground/tree/require-cycle-example
Summary
I use a library that has a cyclical import, which leads to constant log pollution alerting me to refactor the imports.
Metro has support for a
requireCycleIgnorePatterns
option, which isnode_modules
by default. Unfortunately, it appears as if that configuration option gets swallowed up by expo somewhere.In the example repo, I have created a cyclical import and access it on both an Expo Router API route and on the front end. In both cases, my very lenient metro config option is ignored:
Require cycle: components/circular/backend/circle1.ts -> components/circular/backend/circle3.ts -> components/circular/backend/circle2.ts -> components/circular/backend/circle1.ts
Require cycle: components/circular/frontend/circle1.ts -> components/circular/frontend/circle3.ts -> components/circular/frontend/circle2.ts -> components/circular/frontend/circle1.ts
This appears to be web only, and does not occur on iOS.
Environment
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.2.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.8.1 - ~/Library/Caches/fnm_multishells/4396_1705978127572/bin/node
npm: 10.1.0 - ~/Library/Caches/fnm_multishells/4396_1705978127572/bin/npm
SDKs:
iOS SDK:
Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode: 15.2/15C500b - /usr/bin/xcodebuild
npmPackages:
expo: ~50.0.2 => 50.0.2
expo-router: ~3.4.3 => 3.4.4
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.73.2 => 0.73.2
react-native-web: ~0.19.6 => 0.19.10
npmGlobalPackages:
eas-cli: 5.7.0
Expo Workflow: managed
The text was updated successfully, but these errors were encountered: