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.0] New typescript errors for css and import.meta.env #4002

Closed
6 tasks done
IanVS opened this issue Jun 28, 2021 · 1 comment · Fixed by #4003
Closed
6 tasks done

[2.4.0-beta.0] New typescript errors for css and import.meta.env #4002

IanVS opened this issue Jun 28, 2021 · 1 comment · Fixed by #4003

Comments

@IanVS
Copy link
Contributor

IanVS commented Jun 28, 2021

Describe the bug

I attempted an upgrade to vite 2.4.0-beta.0, and I've now started to get two types of typescript errors which I did not have before.

CSS imports:

src/screens/login/Login.tsx:11:20 - error TS2307: Cannot find module './Login.module.css' or its corresponding type declarations.

11 import styles from './Login.module.css';

And

src/index.tsx:6:33 - error TS2339: Property 'env' does not exist on type 'ImportMeta'.

6 const environment = import.meta.env.MODE;

I have "types": ["vite/client"], in my tsconfig.json, but the vite client types don't seem to be picked up. I get Cannot find type definition file for 'vite/client'.

Reproduction

https://codesandbox.io/s/frosty-platform-3i81r?file=/src/index.tsx

System Info

System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 66.11 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.17.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.0 => 2.4.0-beta.0

Used Package Manager

npm

Logs

No response

Validations

@github-actions
Copy link

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

@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants