risen228/cra-alias

ModuleNameMapper duplicate path

IncredibleMrTim opened this issue · 3 comments

Hey Guys

There seems to be an issue where the moduleNameMapper path is replicated

    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/^@components(.*)$/": "/Users/xxx/Documents/Projects/react/xxx/xxx-ui/src/Users/xxx/Documents/Projects/react/xxx/xxx-ui/src/components$1"
      },
      "resolver": /Users/xxx/Documents/Projects/react/xxx/xxx-ui/node_modules/react-scripts/node_modules/jest-pnp-resolver/index.js
    }

this is preventing me from running any of my unit tests

jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "@features": [
        "./features"
      ],
      "@components": [
        "components"
      ],
      "@constants": [
        "./constants"
      ],
      "@context": [
        "./context"
      ],
      "@reducers": [
        "./reducers"
      ],
      "@services": [
        "./services"
      ],
      "@hooks": [
        "./hooks"
      ]
    }
  }
}

Hi @IncredibleMrTim, thanks for the issue. I will check it soon. A question: does it work with ./ before components? But, in any case, I wonder why part of the path is duplicated, so I will look for the reason.

Hey @risenforces yes it does work with ./. I removed this to test if that was the issue. Thanks for looking into this for me.

Fixed in 4.13.16 (796e63c + c4c3f9e)
@IncredibleMrTim