metro icon indicating copy to clipboard operation
metro copied to clipboard

bug: Nested module names change during resolution

Open teodorciuraru opened this issue 1 year ago • 0 comments

Do you want to request a feature or report a bug? Reporting a bug.

What is the current behavior? When trying to resolve a module with a name like fs/promises, it will incorrectly normalize it to fs (omitting the /promises part).

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test. Add fs/promises inside resolver, more exactly, extraNodeModules. By debugging or relying on this import outside your node_modules`, you will see that it's normalized to the first word from the array, as for this piece of code.

What is the expected behavior? I want it to retain the fs/promises whole name to be able to resolve it.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system. Default RN plugin dependencies:

  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.11",
    "babel-plugin-module-resolver": "^5.0.0",
    "metro-react-native-babel-preset": "0.76.8",
    "react-native-config": "^1.5.1",
    "metro-config": "^0.76.7"
  },

Node: v18.18.0 Yarn: 1.22.19 OS: macOS Ventura (13.6)

teodorciuraru avatar Oct 18 '23 16:10 teodorciuraru