open-draft / dotalias

A single configuration for path aliases to reuse across all your tools (TypeScript, Jest, webpack, Rollup, etc.).
91 stars 2 forks source link

Support fallbacks #3

Closed kettanaito closed 3 years ago

kettanaito commented 3 years ago

Expected behavior

// alias.config.js
module.exports = {
  'utils/*': ['src/utils/*', 'src/utils/internal/*']
}

Considering this import:

import compose from 'utils/compose'

Module path resolution happens as follows:

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.