Skip to content
New issue

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

Add paths to tsconfig.json for shorter imports #2195

Open
traeok opened this issue Mar 20, 2023 · 2 comments
Open

Add paths to tsconfig.json for shorter imports #2195

traeok opened this issue Mar 20, 2023 · 2 comments
Labels
priority-low Legit issue but cosmetic or nice-to-have Research Needed Technical Debt Includes Architecture, Code, Testing, Automation debt v3

Comments

@traeok
Copy link
Member

traeok commented Mar 20, 2023

Is your feature request related to a problem? Please describe.

I was looking at a PR with a long relative path and it had me thinking...

import { CredentialManagerOverride } from "../../../../../../packages/security/src/CredentialManagerOverride";

How can we shorten relative imports and make importing more straightforward?

Describe the solution you'd like

We could add paths to tsconfig.json and refer to them with a "root" symbol, e.g. @:
(example is from the CLI, but can be applied here)

import { CredentialManagerOverride } from '@cli/security/...';

Which would involve some changes to tsconfig.json, e.g.:

compilerOptions: {
    baseUrl: "src/",
    paths: {
        "@cli/security": "<path_to_security_modules>",
        // etc.
    }
}

This might also involve updating the webpack config for module resolution.

Describe alternatives you've considered

Relative imports work just fine, but building these might take time depending on the structure of the modules being imported.

@traeok traeok added the enhancement New feature or request label Mar 20, 2023
@github-actions
Copy link

Thank you for raising this issue.
The community has 90 days to upvote 👍 the issue.
If it receives 10 upvotes, we will move it to our backlog. If not, we will close it.

@JTonda JTonda added Technical Debt Includes Architecture, Code, Testing, Automation debt Research Needed priority-low Legit issue but cosmetic or nice-to-have and removed enhancement New feature or request labels May 9, 2023
@JTonda
Copy link

JTonda commented May 9, 2023

Related to #2214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-low Legit issue but cosmetic or nice-to-have Research Needed Technical Debt Includes Architecture, Code, Testing, Automation debt v3
Projects
Status: Low Priority
Development

No branches or pull requests

2 participants