Skip to content

fix: Use lower case filenames for types so they can be imported correctly on Linux#9827

Closed
Princesseuh wants to merge 1 commit intovitejs:mainfrom
Princesseuh:main
Closed

fix: Use lower case filenames for types so they can be imported correctly on Linux#9827
Princesseuh wants to merge 1 commit intovitejs:mainfrom
Princesseuh:main

Conversation

@Princesseuh
Copy link
Copy Markdown
Contributor

Description

Due to an issue in TypeScript (microsoft/TypeScript#45096), files using uppercased characters can't be imported through a triple slash directive types on Linux.

This is normally not an issue, because Vite refers to those types exclusively using path (since #4031), however it's an issue for third-party projects who needs to refers to those types using types. Example issue from the Astro repo: withastro/astro#4387

Additional context

This should be all, don't hesitate if there's anything I missed!


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@patak-cat
Copy link
Copy Markdown
Member

Thanks for the PR @Princesseuh!

The current file names are part of Vite's API so I'm trying to think how we can make this change without breaking downstream projects. See for example https://vitejs.dev/guide/api-plugin.html#client-server-communication

Maybe we could keep the previous files and point in them to the new ones? If there is a way to make this work, we could release this as a non-breaking change in 3.1 and state that the old files will be removed in Vite 4.

@patak-cat patak-cat requested a review from bluwy August 24, 2022 21:18
@patak-cat patak-cat added the p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) label Aug 24, 2022
@Princesseuh
Copy link
Copy Markdown
Contributor Author

Thanks for the PR @Princesseuh!

The current file names are part of Vite's API so I'm trying to think how we can make this change without breaking downstream projects. See for example https://vitejs.dev/guide/api-plugin.html#client-server-communication

Maybe we could keep the previous files and point in them to the new ones? If there is a way to make this work, we could release this as a non-breaking change in 3.1 and state that the old files will be removed in Vite 4.

While we can do that successfully (as far as I can tell) for most of the files, we can't do this for importMeta.d.ts because we can't export from it since it's a type augmentation. We also can't have the same file duplicated because then you get an error about a duplicate definition (so you'd get an error running tsc without skipLibCheck anyway)

I'm not too sure how to achieve this, hmm. I don't necessarily mind this being a breaking change, fwiw. We (Astro) and other frameworks can fairly easily duplicate the file manually in our repos for now as a workaround

@patak-cat
Copy link
Copy Markdown
Member

I'll add this PR to be discussed in a future team meeting. Maybe it is enough to do this change in a minor, but if not, we could do it in Vite 4 that isn't that far away (probably a few months from now)

@bluwy
Copy link
Copy Markdown
Member

bluwy commented Aug 26, 2022

We (Astro) and other frameworks can fairly easily duplicate the file manually in our repos for now as a workaround

I think this would be the way for now too. I also think that this is a breaking change that we should do for Vite 4.

Also looks like microsoft/TypeScript#45096 is marked in TS 4.8 milestone (though 4.8 is already released). Perhaps it might be resolved soon.

@patak-cat patak-cat added this to the 4.0 milestone Aug 26, 2022
@patak-cat
Copy link
Copy Markdown
Member

Ok, let's target v4. I removed it from the meeting discussion for now.

@patak-cat
Copy link
Copy Markdown
Member

@Princesseuh would you help to test @sapphi-red's #9966? Looks like we could resolve this issue without waiting until Vite 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants