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

React - Cannot find DTS #59

Closed
C0ZEN opened this issue Jun 26, 2023 · 2 comments
Closed

React - Cannot find DTS #59

C0ZEN opened this issue Jun 26, 2023 · 2 comments

Comments

@C0ZEN
Copy link

C0ZEN commented Jun 26, 2023

I followed the React type declarations docs.
Since migrating to Nx 16.4.0 (which adds type check to vite builder), I have the following error while building my app:

Cannot find type definition file for 'vite-plugin-pwa/react'.
  The file is in the program because:
    Entry point of type library 'vite-plugin-pwa/react' specified in compilerOptions

With a config as simple as:

"compilerOptions": {
  "types": ["node", "vite/client", "vitest", "vite-plugin-pwa/react"],
},
@userquin
Copy link
Member

@C0ZEN you can check examples folder, there is an example for react. Try adding src/vite-env.d.ts to your project using refs https://github.com/vite-pwa/vite-plugin-pwa/blob/main/examples/react-router/src/vite-env.d.ts

@C0ZEN
Copy link
Author

C0ZEN commented Jun 26, 2023

@C0ZEN you can check examples folder, there is an example for react. Try adding src/vite-env.d.ts to your project using refs https://github.com/vite-pwa/vite-plugin-pwa/blob/main/examples/react-router/src/vite-env.d.ts

I used this syntax to solve the issue because I tend to avoid the triple slash references:

import 'vite-plugin-pwa/react';
import 'vite-plugin-pwa/info';

Thank you.

@C0ZEN C0ZEN closed this as completed Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants