Subwaytime / vite-aliases

Alias auto generation for Vite
https://www.npmjs.com/package/vite-aliases
MIT License
213 stars 13 forks source link

Generate a more minimal tsconfig paths output for default scenario #61

Open crhistianramirez opened 1 year ago

crhistianramirez commented 1 year ago

For each folder tsconfig.json is updated with a new paths entry. This can get a bit noisy to check in anytime a new folder is created. For the default config which is one level deep the following configuration can be used:

{
  "compilerOptions": {
    "paths":  {
      "@*": ["src/*"]
    }
  }
}

That single configuration can handle any number of folders one level deep

Subwaytime commented 1 year ago

This has been reported multiple times but its not part of the library scope. vite-aliases is specifically build for bigger projects where organisation and management is key.

Also, please do not post non-related Issues to this Git repository, this is neither helpful nor it is a Bugreport.

crhistianramirez commented 1 year ago

vite-aliases is specifically build for bigger projects where organisation and management is key

My suggestion was to reduce the amount of code output to tsconfig.json to a version that is more terse, to improve developer experience. I don't see how that suggestion runs counter to your stated goal.

As an aside, it is common to post enhancement or feature requests to repos. If you don't want that kind of feedback, it might be worth posting something in your readme.

Cheers

Subwaytime commented 1 year ago

Ah okay, sorry, must've misunderstood your issue then! Thought you were pointing out that using one alias is enough, which works for some projects and has been suggested a lot, but like i said isnt the scope of this library.

So are you suggesting if the user sets the option depth to 1, it wont generate any of the folders as aliases?

crhistianramirez commented 1 year ago

Correct, that is my suggestion exactly. It's not a big deal, functionally they are equivalent but I think using this provides a slightly better developer experience because the tsconfig only needs to be updated once whereas with the current implementation adding or removing folders will change the file and require updates to be checked in.

If you think this is a good enhancement I'd be happy to make a pull request. If not, no worries, appreciate your consideration either way.

Subwaytime commented 1 year ago

Hm, i think it might fit well into the current Changes that i am working on! Will post something in this Thread, if i am gonna include it directly in the upcoming changes.

Subwaytime commented 1 year ago

Will be included in the next upcoming v0.12.0