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

v4.0.0 mega thread #77

Closed
aleclarson opened this issue Nov 26, 2022 · 25 comments
Closed

v4.0.0 mega thread #77

aleclarson opened this issue Nov 26, 2022 · 25 comments
Labels
mega thread Avoid making new topics about this

Comments

@aleclarson
Copy link
Owner

aleclarson commented Nov 26, 2022

pnpm i vite-tsconfig-paths@next

Introducing v4.0.0

  • Stop using the tsconfig-paths package
    It is better to let Vite handle all of the resolving, so that this plugin can be only responsible for the path mapping.

    At the same time, I am also adding the tsconfck package, which handles the loading of tsconfig.json files for us. This package is also used in Vite core (we should have Vite expose it in the future, to
    avoid the duplication).

    The tsconfig-paths package was previously responsible for config loading and much of the path resolving logic, but now we can ditch it! I'm also ditching the recrawl-sync package, which was used for crawling the filesystem in search of tsconfig.json files.

  • Remove the extensions option
    Since the file resolution is delegated to Vite core, this option is no longer necessary.

  • Add the parseNative option
    The tsconfck package has a parseNative function that's able to delegate config loading to the TypeScript compiler. If you encounter a bug in tsconfig.json file loading, you can try passing parseNative: true to see if that helps. But you should avoid enabling it otherwise, since it has a noticeable performance cost (up to 600ms roughly speaking).

Fixes #54
Closes #73
Probably fixes #63
Probably fixes #68
Probably fixes #71

Bugs down here 👇

I don't expect there to be bugs, but we don't currently have an extensive test suite, so it's possible. If you find any, let me know and (if you're feeling extra generous) open a PR with a reproduction in the ./demo folder.

  • Regression: The tsconfck package doesn't support jsconfig.json files, so vite-tsconfig-paths has lost the support that was added in v3. See Support jsconfig.json #22
@aleclarson aleclarson pinned this issue Nov 26, 2022
@aleclarson aleclarson added the mega thread Avoid making new topics about this label Nov 26, 2022
@aleclarson
Copy link
Owner Author

If anyone wants to help update the test suite for v4, please see #81.

@aleclarson aleclarson changed the title v4.0.0-alpha mega thread v4.0.0 mega thread Dec 6, 2022
@aniravi24

This comment was marked as outdated.

@aleclarson

This comment was marked as outdated.

@DreierF

This comment was marked as outdated.

@devatrox

This comment was marked as outdated.

@CHR-onicles

This comment was marked as outdated.

@mssngr

This comment was marked as outdated.

@mssngr

This comment was marked as outdated.

@aleclarson
Copy link
Owner Author

aleclarson commented Dec 7, 2022

Seems there were two bugs. Please try v4.0.1

  • A tsconfig file with references array is now used again (unless the files property is explicitly an empty array)
  • The include/exclude patterns are compiled correctly again

@CHR-onicles

This comment was marked as outdated.

@aleclarson

This comment was marked as outdated.

@CHR-onicles

This comment was marked as outdated.

@DreierF
Copy link

DreierF commented Dec 7, 2022

@aleclarson I can at least confirm that 4.0.1 fixed our concrete instance of the problem. Thanks for the fast update!

@aniravi24
Copy link

@aleclarson sorry for the delay, looks like everyone else got to this quickly and discovered the issue (thank you!) I can also confirm 4.0.1 fixed the specific issue I was having.

@DreierF

This comment was marked as outdated.

@mandarini
Copy link

@aniravi24 @DreierF for Nx:

  • To work with 4.0.0 you can remove the projects: ['tsconfig.base.json'] from the plugin in your vite.config.ts files
  • To work with 4.0.1 you still need the projects array

I put in a PR to address that. Other than this, it should work as expected.

@dospolov

This comment was marked as outdated.

@memark
Copy link

memark commented Dec 13, 2022

It would be great if the Releases page were updated with information about this new major version
https://github.com/aleclarson/vite-tsconfig-paths/releases

@alonando

This comment was marked as outdated.

@janakg

This comment was marked as outdated.

@marlosirapuan

This comment was marked as outdated.

@aleclarson
Copy link
Owner Author

Please try v4.0.3 if you're on Windows. Thanks to @joshwooding

@alonando
Copy link

v4.0.3 is working on Windows with latest vite. Thanks @aleclarson & @joshwooding!

@ahnpnl
Copy link

ahnpnl commented Dec 27, 2022

Hi, it'd be nice if GH release page is up-to-date with release tags as well as changelog is mentioned somewhere.

@burtek
Copy link

burtek commented Jan 27, 2023

Would it be possible to have this work also with vitest.mock? Right now the alaises from compilerOptions.paths don't work

Repository owner locked and limited conversation to collaborators Mar 24, 2023
@aleclarson aleclarson unpinned this issue Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
mega thread Avoid making new topics about this
Projects
None yet
Development

No branches or pull requests