-
-
Notifications
You must be signed in to change notification settings - Fork 8k
feat(create-vite): add preact path alias in preact-ts template #13499
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(create-vite): add preact path alias in preact-ts template
- Loading branch information
commit bdd95f5d8f43aa0c4f4f0214706adc6bdabf9dce
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this
baseUrlneeded? The downside with this is that TypeScript would autocomplete imports as"src/components/..."(note leadingsrc/), which wouldn't work in Vite ootb.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah interesting, I didn't know that thanks. I'm using the
baseUrlin this vitejs project: github.com/AJamesPhillips/conversation-helper and when I use VisualStudio code to add a missing import it adds as a relative path like "./components/LogList". How do you recreate the autocomplete imports as "src/..." is this a setting I have set that I'm now unaware of perhaps?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It usually happens when you have a very long path of
../../../../../../and TS intelligently picks the shortsrc/components/..path instead. But anyways, setting thisbaseUrlalso let TS resolves correctly without warnings, so a user who manually type that (for any reason) would falsely think it works too.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Makes sense. I just wish there was a more descriptive error message to point you towards adding "baseUrl" and "paths" to tsconfig.json
Sounds like you don't want this contribution so I'll close this PR. Thanks for your time and help understanding this better 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do want the
pathscontribution! Just not thebaseUrlpart. Is thebaseUrlrequired forpathsto work?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok. I misunderstood. In my own project it seems I can remove "baseUrl" and the following still work without error: imports, type checking, and vite dev/build. So I will hesitantly say yes but I don't really know why preact would recommend adding baseUrl if it wasn't needed.