When it comes to generating source files, I do things a bit differently and create some of them outside of the usual src
directory. Here's how my structure looks:
- project
- generated
- $ui-services
some-other.service.ts
- src
- app
- $ui-services
some.service.ts
To make this setup work, I made sure to specify the following in tsconfig.app.json:
"compilerOptions": {
...
"paths": {
...
"@ui-services/*": ["app/$ui-services/*", "../generated/$ui-services/*"],
...
}
},
"include": [
"./**/*.ts",
"../generated/**/*.ts"
]
With this configuration, I can now import SomeService into SomeOtherService like so:
import {SomeService} from '@ui-services/some.service';
Although everything seems to be working as intended, I've encountered an issue with WebStorm where it fails to properly resolve the aliases in some-other-service.ts.
I've attempted to mark both folders as Resource Root as suggested by some, but unfortunately, that didn't provide a solution.
Is there a way for me to resolve this mismatch in file resolution across directories?