immich icon indicating copy to clipboard operation
immich copied to clipboard

refactor(server): drop module aliases

Open jrasm91 opened this issue 1 year ago • 0 comments

Using modules aliases can be convenient, but also make the build more complex and often frustrating to deal with. This PR replaces modules aliases with root path imports. This has several benefits, including:

  • More transparency around where imports are coming from
  • Less required configuration to integrate with other tools (like jest)
  • Simpler migration path to ESM

Essentially the changeset comes down to removing tsconfig.paths settings and jestConfig.moduleNameMapper configuration by updating the following imports:

Before:

import {} from '@app/domain';
import {} from '@app/infra';
import {} from '@app/immich';
import {} from '@test';

After:

import {} from 'src/domain';
import {} from 'src/infra';
import {} from 'src/immich';
import {} from 'test';

TLDR is this is simpler and looks almost the same as before.

jrasm91 avatar Jan 28 '24 04:01 jrasm91