We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatically resolve custom path aliases in build generated code
I personally can't find the reason why TypeScript does not automatically resolve custom path aliases in the build.
TypeScript is a compiler, so I think that it should take care of that.
To avoid any breaking changes, I think that introducing a new option such as resolveCustomPaths is a good solution.
resolveCustomPaths
When I have the paths option set in the tsconfig.json, TypeScript will automatically resolve the import paths in the generated code.
paths
tsconfig.json
If I have the following tsconfig.json:
{ "compilerOptions": { "baseUrl": "src", "paths": { "@core/*": ["app/core/*"] "@services/*": ["app/services/*"] } } }
And I have the following /src/app/http/controllers/UserController.ts file:
/src/app/http/controllers/UserController.ts
import { ... } from '@services/my-service.ts';
Would be nice if the UserController.ts could be compiled into something like:
UserController.ts
// UserController.js (Compiled) // BaseURL (tsconfig.json `src`) + CustomPath (tsconfig.json `app/services`) + RequiredFile (`my-service.ts`) const { ... } = require('src/app/services/my-service.js');
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered:
See #31643 (comment).
Sorry, something went wrong.
No branches or pull requests
Search Terms
automatically resolve custom path aliases in build generated code
Suggestion
I personally can't find the reason why TypeScript does not automatically resolve custom path aliases in the build.
TypeScript is a compiler, so I think that it should take care of that.
To avoid any breaking changes, I think that introducing a new option such as
resolveCustomPaths
is a good solution.Use Cases
When I have the
paths
option set in thetsconfig.json
, TypeScript will automatically resolve the import paths in the generated code.Examples
If I have the following
tsconfig.json
:And I have the following
/src/app/http/controllers/UserController.ts
file:Would be nice if the
UserController.ts
could be compiled into something like:Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: