Path Aliases
Declared in tsconfig.json with baseUrl: "src".
"paths": {
"@pyb-core/*": ["app/core/*"],
"@pyb-views/*": ["app/views/*"],
"@pyb-environments/*": ["environments/*"],
"@pyb-assets/*": ["assets/*"],
"@pyb-components/*": ["app/views/partials/components/*", "app/core/pyb/components/*"],
"@pyb-modals/*": ["app/views/partials/modals/*"],
"@pyb-vendors/*": ["app/vendors/*"],
"@pyb-tests/*": ["../tests/*"]
}
| Alias | Resolves to | Typical import |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pyb-components maps to two directoriesTypeScript tries
|
Usage rules
|
Never use a relative import across module boundaries. Relative paths are only acceptable within the same folder or to a direct child. |
// good
import { PermissionsService } from '@pyb-core/pyb/services/permissions.service';
import { WelcomeModalComponent } from '@pyb-modals/welcome-modal/welcome-modal.component';
import { CloudWatchService } from '@pyb-vendors/cloud-watch/cloud-watch.service';
// good — sibling file in the same feature folder
import { reducer } from './balance.reducer';
// bad
import { PermissionsService } from '../../../../core/pyb/services/permissions.service';
Barrels
Prefer the barrel where one exists:
|
|
|
|
|
Feature slice exports. |
|
Entity slice exports. |
|
Shared constants. |
|
|
Non-aliased packages
Two Payability packages are consumed as ordinary npm dependencies:
|
Generated API services, DTOs, models and shared enums ( |
|
The shared UI kit ( |