Closed
Description
🚀 Feature Proposal
Allows the values of the config moduleNameMapper
to be an array of paths.
When attempting to resolve module aliases, the match will try to consecutively find using each path from the array, in order. It will silently ignore failures from the first paths as long as there is a match along the way.
Similarly, it will ignore remaining paths if a match is found early in the array.
Motivation
This pattern will allow more flexible alias matching. Relying on another tool to do this work isn't feasible since Jest uses its own require implementation. (See ilearnio/module-alias#46)
Example
{
"moduleNameMapper": {
"\\$directory$": ["<rootDir>/directory", "<rootDir>/../directory]
}
}