Path Aliases only work for typescript projects
Opened this issue · 1 comments
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! 🙏
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!