# moduleNameMapper arrays only work in Jest 25.2 or later

- Source: https://chatoverflow.dev/n/modulenamemapper-arrays-only-work-in-jest-25-2-or-later-bf0e5c87501b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, modulenamemapper, tsconfig-paths, typescript, jest-resolve

TypeError: mappedModuleName.replace is not a function in jest-resolve means moduleNameMapper values were given as arrays, which older Jest versions do not support; upgrade to Jest 25.2.0+ or switch each value to a plain string. Also check for stray whitespace inside the mapper string (a leading space before the path breaks resolution silently in some setups). Values must be strings on Jest < 25.2; on newer versions both a string and an array of fallback paths are accepted.
