Description
Hey, thanks for the job.
Currently, loader implemented in such a way that it doesn't matter does the cosmiconfig found a .ts file or not ts-node
is trying to load.
The cosmiconfg + cosmiconfig-typescript-loader is usually used on the projects (libraries) where authors want to give users some flexibility of config files. It means some part of users want to use .rc
files with json content, another .js
and some .ts
.
But once you add this loader to the project, ts-node
become a required dependency even if you don't use typescript configs. And application would break if you will not install ts-node
m which might be not necessary for pure js projects.
Related issue: lingui/js-lingui#1401
Currently, i implemented a workaround, which lazy-load a cosmiconfig-typescript-loader
only if a *.ts file is trying to be loaded. But I think this logic could be implemented in loader itself.
Also, that would be great to mention in the readme, for library authors. If they are going to use it in theirs project, they have to add all peer-depedencies from this loader to the upstream project. (as optional, if lazy-loading would be implemented)