webpack resolve.alias removes the ../../..

A deep component importing a helper writes ../../../lib/money, and the path breaks the moment the file moves — which makes reorganising a tree a mechanical exercise in fixing imports rather than a decision.

// webpack.config.js
resolve: {
  alias: {
    lib: path.resolve(__dirname, 'src/lib'),
    components: path.resolve(__dirname, 'src/components')
  }
}

// anywhere, at any depth
import { format } from 'lib/money';

The cost is that the alias is a build-tool fact, so anything else reading the source — an editor jumping to definition, a linter resolving imports, a test runner with its own resolver — has to be told about it separately. Keep the list short and name the aliases after directories that genuinely will not move.