Each alias can support a string[] declaration of paths, where each path represents a lookup location of the resolved module, taking priority from left to right.
If src/utils/compose.js does not exist, while src/utils/internal/compose.js does, the latter gets resolved.
If neither of the paths exist, it's a module resolution error (module not found).
Mentions
TypeScript, webpack, and Jest support fallbacks (array of paths) natively. Rollup support would require writing a custom resolver function that looks up the given paths in the filesystem before resolving.
Expected behavior
string[]
declaration of paths, where each path represents a lookup location of the resolved module, taking priority from left to right.Considering this import:
Module path resolution happens as follows:
src/utils/compose.js
exist, it's resolved.src/utils/compose.js
does not exist, whilesrc/utils/internal/compose.js
does, the latter gets resolved.Mentions
TypeScript, webpack, and Jest support fallbacks (array of paths) natively. Rollup support would require writing a custom resolver function that looks up the given paths in the filesystem before resolving.