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

[2.4.0-beta.2] import.meta.env does not typecheck on linux #4028

Closed
IanVS opened this issue Jun 29, 2021 · 1 comment
Closed

[2.4.0-beta.2] import.meta.env does not typecheck on linux #4028

IanVS opened this issue Jun 29, 2021 · 1 comment

Comments

@IanVS
Copy link
Contributor

IanVS commented Jun 29, 2021

Describe the bug

#4003 moved the definition of ImportMeta to a separate file and added a triple-slash directive to reference it. This works fine on case-insensitive operating systems, but not on linux. This seems to be because typescript converts the path to a lowercase string, vite/types/importmeta. This is not resolved on linux, and expressions like import.meta.env will throw a typescript error.

On mac, when I run npx tsc --traceResolution I get:

======== Type reference directive 'vite/types/importmeta' was successfully resolved to '/<absprojectpath>/node_modules/vite/types/importmeta.d.ts' with Package ID 'vite/types/importmeta.d.ts@2.4.0-beta.2', primary: false. ========

On Linux, my coworker sees:

======== Type reference directive 'vite/types/importmeta' was not resolved. ========

I think this is probably a typescript bug, but as a workaround I think it should be possible to rename the files to all-lowercase.

Reproduction

I'm not really sure how to show a reproduction of this problem...

System Info

Works on:


System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 352.24 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.16.1/bin/yarn
    npm: 7.19.0 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Brave Browser: 91.1.26.67
    Firefox: 88.0.1
    Safari: 14.1.1
  npmPackages:
    vite: ^2.4.0-beta.2 => 2.4.0-beta.2

I don't have a linux box to run the command on.



### Used Package Manager

npm

### Logs

_No response_

### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/.github/contributing.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
IanVS added a commit to IanVS/vite that referenced this issue Jun 29, 2021
IanVS added a commit to IanVS/vite that referenced this issue Jun 29, 2021
IanVS added a commit to IanVS/vite that referenced this issue Jun 29, 2021
@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2021
aleclarson pushed a commit to aleclarson/vite that referenced this issue Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant