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

[WIP] 0.7.0 Release #18

Closed
Subwaytime opened this issue Jun 2, 2021 · 4 comments
Closed

[WIP] 0.7.0 Release #18

Subwaytime opened this issue Jun 2, 2021 · 4 comments

Comments

@Subwaytime
Copy link
Owner

Hey there!

The upcoming Release for vite-aliases will include some new Features and Fixes based on a total Rewrite of the Project.
Atm its still WIP so not all Features are 100% tested.

Thusfar if you still need a Stable Release without the new Features, consider using Version 0.6.3
via npm install vite-aliases@0.6.3 -D

0.7.0 New Features:

  • Watcher (will now generate Aliases on Folder add/remove)
  • Revamped Log and Terminal Output
  • JS/TS Config Creation & Update (it will automatically update your PATHS for the specific JSON File, if one exists or just create a File)
  • Small Fixes for old Features

Current "Problems":

  • Log and Config Update only work on restarting Vite
    --> This means, when you add a Folder, but you need IDE Support to autoimport Files for example, consider restarting Vite.

The Reason for this is pretty simple, atm, the Log and Config are only touched once and not per every new Entry (add or removal). I have not had the time to check if the file creation/update process of both functions would have a great performance impact if they are done by the watcher every single time a folderstructure change is happening, so thats why i didnt include it directly. I wanna have this Feature checked perfectly before it ends up causing to much Issues.

@davay42
Copy link

davay42 commented Jun 3, 2021

Great news! I've got an issue with TS not allowing partial options like {dir:'.vitepress'}. And also got duplicates error now because of two components folders in the structure. Will find a way to upgrade later.

@Subwaytime
Copy link
Owner Author

Hey there!
Thanks for the Information, guess ill missed to allow default Config Options ^^
Will get a fix out later..

For the Duplication Error:
The Basic Behavior has not changed from the older Versions.
vite-aliases handles duplicates in the following way:

  1. get the last folder of the given path
  2. turn relative path into absolute
  3. compare generated aliases

Basically if you got two folders with the name components, you got to turn on ignoreDuplicates
This will remove the Error but with a Drawback.
Aliases are generated based on Folderstructure and the folder that is generated after the one with the same name gets overwritten.

src\components -> @components -> F:\work\project\src\components
src\pages\components -> @components -> F:\work\project\src\pages\components

With ìgnoreDuplicates on false this will throw an Error.
With ignoreDuplicates on true, it will get the pages\components as the @components and the first generated aliases is ignored.

Ive got a workaround here that i am working on, but not sure if i do really like the behavior. Basically it will grab the second last folder if there is already a Duplicate existent. @pagesComponents for example..

@davay42
Copy link

davay42 commented Jun 6, 2021

OK, thanks! The other way is to turn off deep and just use @components and @pages/components?

@Subwaytime
Copy link
Owner Author

I redirect the Issue for Duplication to a new Thread!
This needs further exploration i think..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants