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

[HOLD for payment 2023-11-09] [Dev] App bundling fails with CAPTURE_METRICS=true #30565

Closed
hannojg opened this issue Oct 30, 2023 · 2 comments
Closed
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Weekly KSv2

Comments

@hannojg
Copy link
Contributor

hannojg commented Oct 30, 2023

Details

This PR:

introduced a regression, where when you said CAPTURE_METRICS=true in your env and try to run the app, you'll get the following error:

 BUNDLE  ./index.js 

error: index.js: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.

  plugins: [
    ['some-plugin', {}],
    ['some-plugin', {}, 'some unique name'],
  ]

Duplicates detected are:
[
  {
    "alias": "/Users/hannomargelo/Documents/Github/expensify-app-fork/node_modules/babel-plugin-module-resolver/lib/index.js",
    "options": {
      "extensions": [
        ".native.js",
        ".native.jsx",
        ".native.ts",
        ".native.tsx",
        ".js",
        ".jsx",
        ".ts",
        ".tsx",
        ".ios.js",
        ".ios.jsx",
        ".ios.ts",
        ".ios.tsx",
        ".android.js",
        ".android.jsx",
        ".android.ts",
        ".android.tx"
      ],
      "alias": {
        "@assets": "./assets",
        "@components": "./src/components",
        "@hooks": "./src/hooks",
        "@libs": "./src/libs",
        "@navigation": "./src/libs/Navigation",
        "@pages": "./src/pages",
        "@styles": "./src/styles",
        "@src": "./src",
        "@userActions": "./src/libs/actions"
      }
    },
    "dirname": "/Users/hannomargelo/Documents/Github/expensify-app-fork",
    "ownPass": false,
    "file": {
      "request": "module-resolver",
      "resolved": "/Users/hannomargelo/Documents/Github/expensify-app-fork/node_modules/babel-plugin-module-resolver/lib/index.js"
    }
  },
  {
    "alias": "/Users/hannomargelo/Documents/Github/expensify-app-fork/node_modules/babel-plugin-module-resolver/lib/index.js",
    "options": {
      "root": [
        "./"
      ],
      "alias": {
        "ReactNativeRenderer-prod": "/Users/hannomargelo/Documents/Github/expensify-app-fork/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling",
        "scheduler/tracing": "scheduler/tracing-profiling"
      }
    },
    "dirname": "/Users/hannomargelo/Documents/Github/expensify-app-fork",
    "ownPass": false,
    "file": {
      "request": "module-resolver",
      "resolved": "/Users/hannomargelo/Documents/Github/expensify-app-fork/node_modules/babel-plugin-module-resolver/lib/index.js"
    }
  }
]

Reason / solution

This is because if CAPTURE_METRICS in babel.config we push a second instance of the module-resolver plugin. Before the PR it was the only instance, and thus it was working:

App/babel.config.js

Lines 88 to 93 in 2707647

if (process.env.CAPTURE_METRICS === 'true') {
const path = require('path');
const profilingRenderer = path.resolve(__dirname, './node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling');
metro.plugins.push([
'module-resolver',

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 30, 2023
@melvin-bot melvin-bot bot changed the title [Dev] App bundling fails with CAPTURE_METRICS=true [HOLD for payment 2023-11-09] [Dev] App bundling fails with CAPTURE_METRICS=true Nov 2, 2023
Copy link

melvin-bot bot commented Nov 2, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 2, 2023
Copy link

melvin-bot bot commented Nov 2, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.94-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-11-09. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

@hannojg hannojg closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Weekly KSv2
Projects
None yet
Development

No branches or pull requests

1 participant