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

@nx/expo executor sync-deps add more dependencies than necessary #26571

Open
1 of 4 tasks
guillempuche opened this issue Jun 16, 2024 · 3 comments
Open
1 of 4 tasks

@nx/expo executor sync-deps add more dependencies than necessary #26571

guillempuche opened this issue Jun 16, 2024 · 3 comments
Assignees
Labels
scope: react-native Issues relating to React Native type: bug

Comments

@guillempuche
Copy link

Current Behavior

I create a blank Expo project with Nx create with this package https://github.com/guillempuche/test-nx-expo/blob/main/apps/expo/package.json (Emily already fixed a problem #26285 (comment)).

The problem happens when running npm exec nx run expo:sync-deps from the root, it adds packages in dependencies that will be bundled in the app.

// apps/expo/package.json

{
  "name": "expo",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "@testing-library/jest-native": "*",
    "@testing-library/react-native": "*",
    "metro-config": "*",
    "react-native": "*",
    "expo": "*",
    "react-native-svg": "*",
    "react-native-web": "*",
    "expo-dev-client": "~3.3.12",
    "react": "18.2.0",
    "expo-modules-core": "*",
    "expo-dev-launcher": "*",
    "expo-dev-menu": "*",
    "expo-json-menu": "*",
    "expo-json-utils": "*",
    "expo-manifests": "*",
    "expo-asset": "*",
    "expo-font": "*",
    "jest-expo": "*",
    "@nx/devkit": "*",
    "@nx/eslint": "*",
    "@nx/jest": "*",
    "@nx/js": "*",
    "@nx/react": "*",
    "@nx/web": "*",
    "@nx/webpack": "*",
    "chalk": "*",
    "enhanced-resolve": "*",
    "fs-extra": "*",
    "metro-resolver": "*",
    "node-fetch": "*",
    "tsconfig-paths": "*",
    "tslib": "*",
    "@expo/metro-config": "*",
    "react-native-svg-transformer": "*",
    "tsconfig-paths-webpack-plugin": "*",
    "expo-build-properties": "*"
  },
  "scripts": {
    "eas-build-pre-install": "cd ../../ && node tools/scripts/eas-build-pre-install.mjs . apps/expo && cp package-lock.json apps/expo",
    "eas-build-post-install": "cd ../../ && node tools/scripts/eas-build-post-install.mjs . apps/expo",
    "android": "expo run:android",
    "ios": "expo run:ios"
  },
  "devDependencies": {}
}

Expected Behavior

// apps/expo/package.json

{
  "name": "expo",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "@testing-library/jest-native": "*",
    "@testing-library/react-native": "*",
    "metro-config": "*",
    "react-native": "*",
    "expo": "*",
    "react-native-svg": "*",
    "react-native-web": "*",
    "expo-dev-client": "~3.3.12",
    "react": "18.2.0",
    "expo-modules-core": "*",
    "expo-dev-launcher": "*",
    "expo-dev-menu": "*",
    "expo-json-menu": "*",
    "expo-json-utils": "*",
    "expo-manifests": "*",
    "expo-asset": "*",
    "expo-font": "*"
  },
  "scripts": {
    "eas-build-pre-install": "cd ../../ && node tools/scripts/eas-build-pre-install.mjs . apps/expo && cp package-lock.json apps/expo",
    "eas-build-post-install": "cd ../../ && node tools/scripts/eas-build-post-install.mjs . apps/expo",
    "android": "expo run:android",
    "ios": "expo run:ios"
  }
}

GitHub Repo

https://github.com/guillempuche/test-nx-expo/

Steps to Reproduce

  1. npm i
  2. npm exec nx run expo:sync-deps
  3. Packages added

Nx Report

Node   : 20.14.0
OS     : darwin-arm64
npm    : 10.7.0

nx                 : 19.2.3
@nx/js             : 19.2.3
@nx/jest           : 19.2.3
@nx/linter         : 19.2.3
@nx/eslint         : 19.2.3
@nx/workspace      : 19.2.3
@nx/detox          : 19.2.3
@nx/devkit         : 19.2.3
@nx/eslint-plugin  : 19.2.3
@nx/expo           : 19.2.3
@nx/react          : 19.2.3
@nrwl/tao          : 19.2.3
@nx/web            : 19.2.3
@nx/webpack        : 19.2.3
typescript         : 5.3.3
---------------------------------------
Registered Plugins:
@nx/expo/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/detox/plugin

Failure Logs

No response

Package Manager Version

npm 10.7.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@xiongemi
Copy link
Collaborator

xiongemi commented Jul 5, 2024

you can manually change sync-deps target:

    "sync-deps": {
      "executor": "@nx/expo:sync-deps",
      "options": {
        "excludeImplicit": true,
        "exclude": ["@nx/devkit", "@nx/eslint", "@nx/jest", "@nx/js", "@nx/react", "@nx/web", "@nx/webpack"]
      }
    },

@guillempuche
Copy link
Author

guillempuche commented Jul 8, 2024

I might miss something. Nx adds more than only Nx's plugins.

Why does it add these?

    "chalk": "*",
    "enhanced-resolve": "*",
    "fs-extra": "*",
    "metro-resolver": "*",
    "node-fetch": "*",
    "tsconfig-paths": "*",

@brendan-hurley
Copy link

brendan-hurley commented Oct 5, 2024

I have the same problem, but with some additional dependencies added:

Node           : 20.11.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 1.22.22

nx                 : 19.8.4
@nx/js             : 19.8.4
@nx/jest           : 19.8.4
@nx/linter         : 19.8.4
@nx/eslint         : 19.8.4
@nx/workspace      : 19.8.4
@nx/cypress        : 19.8.4
@nx/detox          : 19.8.4
@nx/devkit         : 19.8.4
@nx/eslint-plugin  : 19.8.4
@nx/expo           : 19.8.4
@nx/react          : 19.8.4
@nx/react-native   : 19.8.4
@nx/rollup         : 19.8.4
@nx/storybook      : 19.8.4
@nrwl/tao          : 19.8.4
@nx/web            : 19.8.4
@nx/webpack        : 19.8.4
nx-cloud           : 19.1.0
typescript         : 5.3.3

These are added to dependencies:

    "@nx/devkit": "*",
    "@nx/eslint": "*",
    "enhanced-resolve": "*",
    "metro-resolver": "*",
    "node-fetch": "*",
    "picocolors": "*",
    "ajv": "*",
    "chalk": "*",
    "glob": "*",
    "ignore": "*"

Is the recommended advice just to exclude these? Like @guillempuche these things seem to populate from nowhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: react-native Issues relating to React Native type: bug
Projects
None yet
Development

No branches or pull requests

4 participants