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

Path Aliases only work for typescript projects #78

Open
PeteBBC opened this issue Aug 11, 2023 · 1 comment
Open

Path Aliases only work for typescript projects #78

PeteBBC opened this issue Aug 11, 2023 · 1 comment
Labels
core enhancement New feature or request

Comments

@PeteBBC
Copy link

PeteBBC commented Aug 11, 2023

js projects can have aliases configured in a jsconfig file.

Currently they won't be discovered if you run the CLI with --tsconfig jsconfig.json, however.

This looks to be because buildFromEntrypoint in packages/skott/src/skott.ts only runs buildPathAliases for .ts entrypoints:

if (isTypeScriptModule(entrypointModulePath)) {
  const rootTSConfig = await buildPathAliases(
    this.fileReader,
    this.config.tsConfigPath,
    this.#workspaceConfiguration.pathAliases,
    this.logger
  );
  this.#workspaceConfiguration.typescript = rootTSConfig;
}

Thanks again for the great work! 🙏

@antoine-coulon
Copy link
Owner

antoine-coulon commented Aug 15, 2023

Hey again @PeteBBC, thanks for opening that issue and for the kind words 😄

The only path alias mechanism supported by skott for now is TypeScript.

I'm not really familiar with jsconfig files, is that a widely used standard? I'm aware of path aliases that can be defined through manifest files (package.json) and I believe that this will be the way to go in the future, but never saw jsconfig files in action yet. How are these paths converted afterwards so that they are runtime compatible?

Nevertheless it's definitely something that skott could support, if skott supports TS path aliases there is no reason that JS path aliases aren't, either if that's through jsconfig or package.json files!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants